Skip to content

Instantly share code, notes, and snippets.

@petehunt
Created July 9, 2013 23:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save petehunt/5962128 to your computer and use it in GitHub Desktop.
Save petehunt/5962128 to your computer and use it in GitHub Desktop.
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