Closed DouglasHennrich closed 8 years ago
Well. Is it possible to have the global shape of your success handler ?
It is just an function with console.log
.
Maybe titanium don't support promises? Im running on node 4.2.2 and TiSDK 5.1.1.GA
Promises are brought by another library which is plain vanilla-javascript, thus, the issue is likely to be something else; maybe in the implementation of the module itself - we are still currently testing it. Are you running on iOS or Android ?
Huum... iOS
I realize that I'm getting this Event loop not supported
error when I'm requiring the lib too
Indeed. This seems to be an issue with the promise library and JavaScriptCore on iOS. We're trying to figure it out.
Thanks =)
Hey Douglas, We reproduced the issue but we had no clue how to fix it, so we changed the implementation of Promises for this one: https://github.com/floatdrop/pinkie I works as expected now. Thanks for your feedback!
Thanks for your module :D
I'm sorry but it still not working ):
Alloy.js
:
// HTTP Request
Alloy.Globals.HTTPRequest = require('ts.httprequest');
main.js
:
function handleError(error){
console.log('Error: ', JSON.stringify(error));
};
function handleSuccess(success){
console.log('handleSuccess: ', JSON.stringify(success));
};
var request = new Alloy.Globals.HTTPRequest({
method: "GET"
, url: "http://www.google.com"
, data: { }
}).then(handleSuccess).catch(handleError);
terminal output:
[INFO] HTTPRequest handleSuccess for url (GET) http://www.google.com
[ERROR] : Event loop not supported.
tiapp.xml
:
<module platform="commonjs" version="1.4.2">ts.httprequest</module>
<sdk-version>5.1.1.GA</sdk-version>
I'm getting this error when I try to use it =l
this is what output: