[TIMOB-19010] Windows: Support Async methods on Native API wrappers
GitHub Issue | n/a |
---|---|
Type | New Feature |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2015-08-20T21:36:09.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 5.0.0 |
Components | Tooling, Windows |
Labels | n/a |
Reporter | Christopher Williams |
Assignee | Christopher Williams |
Created | 2015-06-12T14:55:57.000+0000 |
Updated | 2017-03-16T22:02:28.000+0000 |
Description
We currently "skip" any method that is Async on the native APIs right now. To properly support them will require generating a "Promise"-like wrapper. See https://msdn.microsoft.com/en-us/library/windows/apps/br211867.aspx
Effectively we need to return an object that encapsulates the async operation and allows users to chain a series of async operations to run in series using callback methods.
The important methods here are: then, done and cancel. Under the hood, we'll likely have to use ppltasks library to wrap up the async operations. See https://msdn.microsoft.com/en-us/library/windows/apps/hh780559.aspx
not sure if it's useful, but async tweaked a memory of hyperloop v1... i had added support for those async classes -- an example usage is here: https://github.com/appcelerator/hyperloop/blob/master/examples/windows/marvel/app.hjs#L48 we generated the promise wrapper here: https://github.com/appcelerator/hyperloop/blob/171c406b12e88d4c81a1baab800b0c9c9ac1df26/lib/windows/jsc/templates/class.ejs#L104 it only had "then", which was implemented to return undefined so you couldn't chain them together, cancel, etc. But maybe this will be helpful when we implement this again...
Closing ticket as fixed.