Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-24098] Windows: Async native function calls

GitHub Issuen/a
TypeImprovement
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2017-04-11T13:41:49.000+0000
Affected Version/sRelease 5.4.0
Fix Version/sHyperloop 2.1.0
ComponentsWindows
Labelsn/a
ReporterKota Iguchi
AssigneeKota Iguchi
Created2016-11-04T00:32:38.000+0000
Updated2017-04-19T01:42:05.000+0000

Description

Some of the WinRT APIs return asynchronous return types, such as Windows.Foundation.IAsyncAction. For methods that return an asynchronous return type, the operation need be wrapped in a [JavaScript Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) object.

var PathIO = require('Windows.Storage.PathIO');
PathIO.ReadTextAsync('ms-appdata:///somefile.txt').then(
    function (content) {
        alert(content);
    },
    function (err) {
        alert('It failed!');
    }
);

Comments

  1. Abir Mukherjee 2017-04-19

    Validated fix with this environment: Node Version: 6.10.1 NPM Version: 4.4.4 Appc CLI: 6.2.0 Appc CLI NPM: 4.2.9 Titanium SDK version: 6.1.0v20170417190415 Appcelerator Studio, build: 4.8.1.201612050850 OS: Windows 10.0.14393 Targets: Windows 8.1 & 10 Devices. Windows 10 Emulator Hyperloop 2.1.0 I installed and executed the demo code that was presented in the PR. With the above emulator and devices, I was able to see the raw HTML content after clicking the button.

JSON Source