53 lines
2.7 KiB
Markdown
53 lines
2.7 KiB
Markdown
# smartchok
|
|
smart wrapper for chokidar
|
|
|
|
## Availabililty
|
|
[](https://www.npmjs.com/package/smartchok)
|
|
[](https://GitLab.com/pushrocks/smartchok)
|
|
[](https://github.com/pushrocks/smartchok)
|
|
[](https://pushrocks.gitlab.io/smartchok/)
|
|
|
|
## Status for master
|
|
[](https://GitLab.com/pushrocks/smartchok/commits/master)
|
|
[](https://GitLab.com/pushrocks/smartchok/commits/master)
|
|
[](https://www.npmjs.com/package/smartchok)
|
|
[](https://david-dm.org/pushrocks/smartchok)
|
|
[](https://www.bithound.io/github/pushrocks/smartchok/master/dependencies/npm)
|
|
[](https://www.bithound.io/github/pushrocks/smartchok)
|
|
[](https://nodejs.org/dist/latest-v6.x/docs/api/)
|
|
[](https://nodejs.org/dist/latest-v6.x/docs/api/)
|
|
[](http://standardjs.com/)
|
|
|
|
## Usage
|
|
Use TypeScript for best in class instellisense.
|
|
|
|
```javascript
|
|
import { Smartchok } from 'smartchok'
|
|
|
|
let mySmartChok = new Smartchok(['some/path/**/*.any','/absolute/*.js'], chokidarOptions)
|
|
|
|
mySmartChok.add(['/some/**/*.any']) // add files
|
|
|
|
mySmartChok.remove('some/**/*.js')
|
|
|
|
mySmartChok.start() // starts the watch process
|
|
|
|
mySmartChok.getObservableFor('change').then((observableArg) => {
|
|
observableArg.subscribe(x => {
|
|
// do something here when a change is detected
|
|
// possible events are 'add' | 'addDir' | 'change' | 'error' | 'unlink' | 'unlinkDir' | 'ready' | 'raw'
|
|
// note that the observable is only created once you call .start() on the Smartchok instance
|
|
// hence the promise construction
|
|
})
|
|
})
|
|
|
|
mySmartChok.stop()
|
|
```
|
|
|
|
For further information read the linked docs at the top of this README.
|
|
|
|
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
|
|
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html)
|
|
|
|
[](https://push.rocks)
|