Skip to content

Commit

Permalink
Merge pull request #156 from ubershmekel/patch-2
Browse files Browse the repository at this point in the history
Late load of paperjs should still run paperscripts
  • Loading branch information
lehni committed Feb 14, 2013
2 parents 779d076 + a3a211e commit 6729646
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/core/PaperScript.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,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:
Expand Down

0 comments on commit 6729646

Please sign in to comment.