Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-19010] Windows: Support Async methods on Native API wrappers

GitHub Issuen/a
TypeNew Feature
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2015-08-20T21:36:09.000+0000
Affected Version/sn/a
Fix Version/sRelease 5.0.0
ComponentsTooling, Windows
Labelsn/a
ReporterChristopher Williams
AssigneeChristopher Williams
Created2015-06-12T14:55:57.000+0000
Updated2017-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

Comments

  1. Dawson Toth 2015-07-01

    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...
  2. Lee Morris 2017-03-16

    Closing ticket as fixed.

JSON Source