Code is something like this.
//Extending a Nativescript module.
var test = ImageProvider.extend({
getImage: function(url){
//async call to get the image from cache
cacheService.getImage(url,
function(image){
return image
},
function(error){
return null
});
}
});
How do i prevent the getImage function to return before image is provided ? I prefer not to use typescript or babel to solve the problem. But please advice if needed. (also tried babel,typescript without any luck) I have tried to use await and yield by setting:
"android": {"v8Flags": "--expose_gc --use_strict --harmony"}
in the package.json file without success.
A sample giving errors using yield
"use strict"
function onNavigationgTo(args){
yield test();
}
function* test(){
return 1;
}
It works without error before i add the yield keyword. Using yield gives the following. SyntaxError: Unexpected strict mode reserved word File : "unknown"