hotmop
v2.0.0
Published
Code hotswapping for your node.js modules
Downloads
3
Readme
hotmop
hot-reload your node modules
emits 'error' on syntax errors
installation
npm install hotmop
usage
in myModule.js
module.exports = {
stuff: 'nice',
moreStuff: 'nice',
}
in main.js
var hotmop = require('hotmop')
var myCoolModule = require('./myModule.js')
var f = __dirname + '/myModule.js'
var swapper = hotmop(f)
swapper.on('swap', function (newModule) {
myCoolModule = newModule
console.log('swapped module!', myCoolModule)
})
swapper.on('error', function (err) {
console.log('error in first module!', err)
})
api
hotmop(absolutePath)
returns an event emitter.
emitter events
swap
- when a watched module has changederror
- if there was a filesystem error or syntax error
license
BSD-2-Clause