From 8574c1ebf6c925ca4cadca4628628160c09177a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Mon, 25 Aug 2014 13:21:58 +0200 Subject: [PATCH] Return the created scope from PaperScript.load() --- src/core/PaperScript.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/core/PaperScript.js b/src/core/PaperScript.js index 90e9cf0c..f3c22ce3 100644 --- a/src/core/PaperScript.js +++ b/src/core/PaperScript.js @@ -483,6 +483,7 @@ Base.exports.PaperScript = (function() { } // Mark script as loaded now. script.setAttribute('data-paper-ignore', 'true'); + return scope; } } @@ -504,13 +505,11 @@ Base.exports.PaperScript = (function() { * @function * @param {HTMLScriptElement} [script=null] the script to load. If none is * provided, all scripts of the HTML document are iterated over and loaded. + * @return {PaperScope} the scope produced for the passed {@code script}, or + * {@code undefined} of multiple scripts area loaded. */ function load(script) { - if (script) { - loadScript(script); - } else { - loadAll(); - } + return script ? loadScript(script) : loadAll(); } // Catch cases where paper.js is loaded after the browser event has already