Node Hot Swap Module
JavaScript
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
tests
.gitignore
Makefile
README.md
index.js
package.json

README.md

Hot Swap Module

A hot swap module help you load node module dynamically.

currently only support local path.

var HS = require('hs');
var hs = new HS();

var one = hs.plug('test', 'one', '../tests/mock/modules/one.js');
var two = hs.plug('test', 'two', '../tests/mock/modules/two.js');

one.test();
two.test();

hs.unplug('test', 'two', function(err, type, name){
  hs.get('test', 'two', function(obj){
    console.log(obj);
  });
});

hs.unplug('test', 'two');

try{
  console.log(two.test());
}catch(e){
  console.log(e);
}