On Tue, Dec 10, 2013 at 4:40 PM, Michael Gauthier <m...@silverorange.com>wrote:

> I quickly updated the File plugin to do the local file uri stuff in
> resolveLocalFileSystemURI in the background using [self.commandDelegate
> runInBackground:^{}].
>

Dev or master?


>
> It works and allows my app interface to respond while the FS calls are
> resolving. Is this approach crazy or obviously broken in some way?
>

Probably not crazy -- depending on how you've implemented it :) It's
basically what I'm doing in my branch as well.

Currently, I have CDVFile using that pattern, [self.commandDelegate
runInBackground:], to call the actual implementation method in
CDVLocalFilesystem or CDVAssetLibraryFilesystem. CDVFile passes the
implementation methods a callback function that sends the actual plugin
response when the operation is finished. (Keeping all of the
"Cordova-plugin-y" bits in CDVFile, and just having the raw file operations
in the file system implementation classes.

You can see an example of what I've done in the implementation of [CDVFile
readAsText:] and in [CDVLocalFilesystem readFileAtURL:start:end:callback:]
in the dev branch.

Ian

Reply via email to