mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-04 03:45:58 -05:00
Return the created scope from PaperScript.load()
This commit is contained in:
parent
02b91d4829
commit
8574c1ebf6
1 changed files with 4 additions and 5 deletions
|
@ -483,6 +483,7 @@ Base.exports.PaperScript = (function() {
|
||||||
}
|
}
|
||||||
// Mark script as loaded now.
|
// Mark script as loaded now.
|
||||||
script.setAttribute('data-paper-ignore', 'true');
|
script.setAttribute('data-paper-ignore', 'true');
|
||||||
|
return scope;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -504,13 +505,11 @@ Base.exports.PaperScript = (function() {
|
||||||
* @function
|
* @function
|
||||||
* @param {HTMLScriptElement} [script=null] the script to load. If none is
|
* @param {HTMLScriptElement} [script=null] the script to load. If none is
|
||||||
* provided, all scripts of the HTML document are iterated over and loaded.
|
* 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) {
|
function load(script) {
|
||||||
if (script) {
|
return script ? loadScript(script) : loadAll();
|
||||||
loadScript(script);
|
|
||||||
} else {
|
|
||||||
loadAll();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Catch cases where paper.js is loaded after the browser event has already
|
// Catch cases where paper.js is loaded after the browser event has already
|
||||||
|
|
Loading…
Reference in a new issue