Return the created scope from PaperScript.load()

This commit is contained in:
Jürg Lehni 2014-08-25 13:21:58 +02:00
parent 02b91d4829
commit 8574c1ebf6

View file

@ -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