任何用于在 HTTPClient 中添加 Promise 的库?

Any Library for adding Promise in HTTPClient?

有谁知道可以将 Promise 添加到 Titanium HTTPClient 中的库吗?

提前致谢。

我用bluebird with Appcelerator Titanium/Alloy. It is very fast and they have good api documentation and examples.

要在您的代码中使用它,只需下载 full or core 版本并将其另存为 bluebird.js 在您的 app/lib 文件夹中。然后从 Titanium Alloy 你可以使用这个代码:

var Promise = require('bluebird');

Note: Working with promises can take a bit of practice and experience to get your code working correctly but once you do, you will reap the benefits of promises. There are a lot of good sites out there on promises that can be very helpful.

此外,您可能想看看 {nativeloop}。它是 运行 在 Appcelerator Titanium 和 Alloy 之上,它为您提供承诺、es6 等等!