Skip to content

Instantly share code, notes, and snippets.

@ORESoftware
Created September 22, 2015 06:29
Show Gist options
  • Save ORESoftware/673d66ef03adabc897a2 to your computer and use it in GitHub Desktop.
Save ORESoftware/673d66ef03adabc897a2 to your computer and use it in GitHub Desktop.
hotReloader.js
define(function () {
var hotReloadSimple = function (item, callback) {
require.undef(item); //delete cache representing module; this means the next require call to the same module will then have to pull the module from filesystem
require([item], function (module) { //load the file asynchronously, because the cache has been deleted
callback(null, module);
});
};
return {
hotReload:hotReloadSimple
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment