From 16946592b7c16e95748b2731909330de34a7ad8e Mon Sep 17 00:00:00 2001 From: Dominik Schmidt Date: Fri, 20 Nov 2015 22:12:16 +0100 Subject: [PATCH] Allow script jobs to return object members directly if they are not functions --- data/js/tomahawk.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/data/js/tomahawk.js b/data/js/tomahawk.js index 3be31d831..ad77cb8e9 100644 --- a/data/js/tomahawk.js +++ b/data/js/tomahawk.js @@ -778,7 +778,9 @@ Tomahawk.PluginManager = { } } - if (typeof this.objects[objectId][methodName] !== 'function') { + if (typeof this.objects[objectId][methodName] !== 'function' && this.objects[objectId][methodName]) { + return this.objects[objectId][methodName]; + } else if (typeof this.objects[objectId][methodName] !== 'function') { throw new Error('\'' + methodName + '\' on ScriptObject ' + objectId + ' is not a function', typeof this.objects[objectId][methodName]); }