Last active
August 29, 2015 14:04
-
-
Save marclundgren/6a6db0bd262326e61d52 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function uploadFileTree(treeNode, folderId) { | |
/* | |
return a Promise *(first Promise)* | |
if treeNode is a file... | |
create an html5 file | |
resolve the promise on `uploadcomplete` | |
reject the promise on `uploaderror` | |
upload the html5 file to the folderId's URL | |
else if treeNode is a directory... | |
use the Service to add a folder with | |
parentFolderId set to folderId | |
... | |
during the Service callback... | |
create a directory reader | |
read entries... | |
recursive call: uploadFileTree with entries | |
and our new folderId from the response | |
... | |
resolve all promises that are mapped to | |
entries, and once all promises are resolved | |
resolve the *(first Promise)* | |
*/ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment