1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-07-31 19:30:21 +02:00

Add nativeScriptJob errors

This commit is contained in:
Dominik Schmidt
2015-11-19 06:20:28 +01:00
parent e8aa2e6de9
commit e997a194a4
5 changed files with 35 additions and 3 deletions

View File

@@ -893,13 +893,21 @@ Tomahawk.NativeScriptJobManager = {
Tomahawk.invokeNativeScriptJob(requestId, methodName, encodeParamsToNativeFunctions(params));;
return deferred.promise;
},
reportNativeScriptJobResult: function (requestId, result) {
reportNativeScriptJobResult: function(requestId, result) {
var deferred = this.deferreds[requestId];
if (!deferred) {
Tomahawk.log("Deferred object with the given requestId is not present!");
}
deferred.resolve(result);
delete this.deferreds[requestId];
},
reportNativeScriptJobError: function(requestId, error) {
var deferred = this.deferreds[requestId];
if (!deferred) {
console.log("Deferred object with the given requestId is not present!");
}
deferred.reject(error);
delete this.deferreds[requestId];
}
};