New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AndroidDeferredObject running callbacks in background thread #33
Comments
@korkag let me look into that.. but if you always want to do things in the background, you should be able to simply use the DefaultDeferredManager. |
No, sometimes i want to be able to run it in background, sometimes in UI thread (android). Workaround, i extended from AndroidDeferredObject and did override trigger functions like: @OverRide Thanks |
gotcha - i think that's a bit more tricky... |
Any progress? Do you want me to help? Lets discuss about implementation. |
absolutely would be happy to discuss and help is definitely welcomed. cancellation is a bit tricky - there was an open issue on this, since the thread will need to handle cancellation properly. when not handled properly, it will cause issues. |
Are you using this library in your projects? On Mon, Aug 11, 2014 at 6:08 PM, Ray Tsang notifications@github.com wrote:
|
of course =) but it is opensource after all, any contribution for needs/fixes are welcomed. i don't think that spawning new threads w/o an executor service is a general enough use case. I'm happy that you were able to extend it to fit your need. it is a bit tricky. |
In Android I want to be able to run callbacks in background thread when resolve called from UI thread and AndroidExecutionScope.BACKGROUND passed in constructor. For example if i run this code in UI thread:
DeferredObject deferred = new DeferredObject();
AndroidDeferredObject androidDeffered = new
AndroidDeferredObject(deferred,AndroidExecutionScope.BACKGROUND);
androidDeffered.then(new DoneCallback(){
// currently run in UI thread, suppose to be running in background thread
});
androidDeffered.resolve("Done");
I don't want to use AndroidDefferedManager, since i want to return to my application Promise without done method and trigger it via resolve function.
The text was updated successfully, but these errors were encountered: