Created
July 9, 2013 23:07
-
-
Save petehunt/5962128 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
function resetBrowserify(cb) { | |
window.require = null; | |
// TODO: somehow identify all browserified script tags | |
var scripts = Array.prototype.slice.call(document.querySelectorAll("script[src='build/browserified.js']")); | |
scripts.map(function(script) { | |
script.remove(); | |
var newScript = document.createElement('script'); | |
newScript.src = script.src; | |
document.head.appendChild(newScript); | |
}); | |
// TODO: i forget how to detect if a script has been loaded or not | |
setTimeout(cb, 1000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment