You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi everybody,
I'm trying to retrieve data from a javascript function in an application running on Chromium v53. The function returns a promise which contains an object with the values I'm looking for. The problem I'm having is that I can't resolve the promise.
The following code works fine if I execute it directly in chrome:
var list = app.db.getTracklist('SELECT * FROM Songs', -1);
console.log(list.isLoaded); // returns false
console.log(list.asJSON); // returns blank data
list.whenLoaded().then(function(result){
console.log(result.isLoaded) //returns true
console.log(result.asJSON) // returns the data I want
})
What I want to do in my application is the following:
var cmd = new EvaluateCommand{
ObjectGroup = "console",
IncludeCommandLineAPI = true,
DoNotPauseOnExceptionsAndMuteConsole = false,
ReturnByValue = true,
Expression = "app.db.getTracklist('SELECT * FROM Songs', -1)"
};
var response = chromeSession.SendAsync(cmd).Result as CommandResponse<EvaluateCommandResponse>;
Console.WriteLine(response.Result.Result.Value);
The last line prints a json object which has the properties isLoaded and asJSON - which are false and blank, respectively. That makes sense since whenLoaded() needs to be called in order to load the data. If I change the expression of the call to "app.db.getTracklist('SELECT * FROM Songs', -1).whenLoaded()", SendAsync() returns a promise (as opposed to the object the promise returns). If I execute synchronous functions I get correct results, so I'm positive that the basic setup is fine.
Does anybody know what I need to do in order to get the data that would be returned in the then() block of the original function?
The text was updated successfully, but these errors were encountered:
Hi everybody,
I'm trying to retrieve data from a javascript function in an application running on Chromium v53. The function returns a promise which contains an object with the values I'm looking for. The problem I'm having is that I can't resolve the promise.
The following code works fine if I execute it directly in chrome:
What I want to do in my application is the following:
The last line prints a json object which has the properties isLoaded and asJSON - which are false and blank, respectively. That makes sense since whenLoaded() needs to be called in order to load the data. If I change the expression of the call to "app.db.getTracklist('SELECT * FROM Songs', -1).whenLoaded()", SendAsync() returns a promise (as opposed to the object the promise returns). If I execute synchronous functions I get correct results, so I'm positive that the basic setup is fine.
Does anybody know what I need to do in order to get the data that would be returned in the then() block of the original function?
The text was updated successfully, but these errors were encountered: