[TIMOB-24671] Windows: JS Callback in async should be done on UI thread
GitHub Issue | n/a |
---|---|
Type | Story |
Priority | Medium |
Status | Closed |
Resolution | Done |
Resolution Date | 2017-05-24T22:29:16.000+0000 |
Affected Version/s | Release 6.1.0 |
Fix Version/s | n/a |
Components | Windows |
Labels | n/a |
Reporter | Kota Iguchi |
Assignee | Kota Iguchi |
Created | 2017-05-10T08:44:37.000+0000 |
Updated | 2017-06-06T11:03:52.000+0000 |
Description
We should make sure all JavaScript callback that is in async operation is done on UI thread. Otherwise we saw crash when callback touches UI properties especially on Windows Store apps. We haven't usually see this problem on Windows Phone apps.
Typically we use
TitaniumWindows::Utility::RunOnUIThread
. It's going to look like below:
concurrency::create_task(object__->DoSomethingAsync()).then([]()({
TitaniumWindows::Utility::RunOnUIThread([](){
js_callback();
});
})
Done with https://github.com/appcelerator/titanium_mobile_windows/pull/1001