Created
May 4, 2016 19:43
-
-
Save atduskgreg/734dcd32e80283b83ca5cb82d69030bd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver; | |
var observer = new MutationObserver(function(mutations) { | |
mutations.forEach(function(mutation) { | |
if(mutation.addedNodes.length > 0 && mutation.addedNodes[0].nodeName == "CANVAS"){ | |
// do stuff after the sketch loaded | |
} | |
}); | |
}); | |
var config = { attributes: false, childList: true, characterData: false } | |
target = document.getElementById("myDiv") | |
observer.observe(target, config); | |
new p5(mySketch, target); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment