Package Exports
- lnwatch
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (lnwatch) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
lnwatch
Small utility for node, to watch symlink changes.
Usage
var lnw = require('../lnwatch.js')
lnw.on('change', function (data) {
console.log('LINK CHANGED', data);
})
lnw.add([
'./foo',
'./qux', // nonexistent link, ignored
'./bar'
])
Methods
lnwatch.add(links)
Add links to watch, can be a single link path string, or several in an array. Nonexistent links will be ignored.
lnwatch.remove([links])
Remove watched links, can be a single link path string, or several in an array. Nonexistent links will be ignored.
lnwatch.removeAll()
Remove all watched links.
Events
lnw.on('change', callback)
Fired when one of the watched link changes target. Receives data about what changed:
- which link,
- from what target,
- to which target
Example:
lnw.on('change', function (data) {
console.log(data);
})
/*
outputs:
{
link: '/Users/nec/github/lnwatch/tests/bar',
from: '/Users/nec/github/lnwatch/tests/two',
to: '/Users/nec/github/lnwatch/tests/three'
}
*/