1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-05 05:37:29 +02:00

Allow instantaneous returns for nativeScriptJobs

This commit is contained in:
Dominik Schmidt
2015-11-19 06:19:53 +01:00
parent 17d71b413f
commit 29aa9546a8

View File

@@ -886,9 +886,10 @@ Tomahawk.NativeScriptJobManager = {
deferreds: {}, deferreds: {},
invoke: function (methodName, params) { invoke: function (methodName, params) {
var requestId = this.idCounter++; var requestId = this.idCounter++;
Tomahawk.invokeNativeScriptJob(requestId, methodName, encodeParamsToNativeFunctions(params)); var deferred = RSVP.defer();
this.deferreds[requestId] = RSVP.defer(); this.deferreds[requestId] = deferred;
return this.deferreds[requestId].promise; Tomahawk.invokeNativeScriptJob(requestId, methodName, encodeParamsToNativeFunctions(params));;
return deferred.promise;
}, },
reportNativeScriptJobResult: function (requestId, result) { reportNativeScriptJobResult: function (requestId, result) {
var deferred = this.deferreds[requestId]; var deferred = this.deferreds[requestId];