mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-06 04:42:15 -05:00
Late load of paperjs should still run paperscripts
See this problem html http://stackoverflow.com/questions/14110205/dynamically-loading-a-script-changes-its-behaviour/14114337 and note how jquery handle this at https://github.com/jquery/jquery/blob/master/src/core.js#L768
This commit is contained in:
parent
b04eb2b98f
commit
a3a211eead
1 changed files with 7 additions and 1 deletions
|
@ -298,7 +298,13 @@ var PaperScript = this.PaperScript = new function() {
|
|||
}
|
||||
}
|
||||
|
||||
DomEvent.add(window, { load: load });
|
||||
// Catch cases where paperjs is loaded after the browser event has already occurred.
|
||||
if ( document.readyState === "complete" ) {
|
||||
// Handle it asynchronously
|
||||
setTimeout( load );
|
||||
} else {
|
||||
DomEvent.add(window, { load: load });
|
||||
}
|
||||
|
||||
// Produces helpers to e.g. check for both 'canvas' and 'data-paper-canvas'
|
||||
// attributes:
|
||||
|
|
Loading…
Reference in a new issue