smartchok/README.md

57 lines
2.7 KiB
Markdown
Raw Normal View History

2016-11-18 23:36:48 +00:00
# smartchok
2018-02-28 23:08:08 +00:00
2016-11-18 23:36:48 +00:00
smart wrapper for chokidar
## Availabililty
2018-02-28 23:08:08 +00:00
2017-02-15 20:58:34 +00:00
[![npm](https://pushrocks.gitlab.io/assets/repo-button-npm.svg)](https://www.npmjs.com/package/smartchok)
[![git](https://pushrocks.gitlab.io/assets/repo-button-git.svg)](https://GitLab.com/pushrocks/smartchok)
[![git](https://pushrocks.gitlab.io/assets/repo-button-mirror.svg)](https://github.com/pushrocks/smartchok)
[![docs](https://pushrocks.gitlab.io/assets/repo-button-docs.svg)](https://pushrocks.gitlab.io/smartchok/)
2016-11-18 23:36:48 +00:00
## Status for master
2018-02-28 23:08:08 +00:00
2017-02-15 20:58:34 +00:00
[![build status](https://GitLab.com/pushrocks/smartchok/badges/master/build.svg)](https://GitLab.com/pushrocks/smartchok/commits/master)
[![coverage report](https://GitLab.com/pushrocks/smartchok/badges/master/coverage.svg)](https://GitLab.com/pushrocks/smartchok/commits/master)
[![npm downloads per month](https://img.shields.io/npm/dm/smartchok.svg)](https://www.npmjs.com/package/smartchok)
2016-11-18 23:41:05 +00:00
[![Dependency Status](https://david-dm.org/pushrocks/smartchok.svg)](https://david-dm.org/pushrocks/smartchok)
[![bitHound Dependencies](https://www.bithound.io/github/pushrocks/smartchok/badges/dependencies.svg)](https://www.bithound.io/github/pushrocks/smartchok/master/dependencies/npm)
[![bitHound Code](https://www.bithound.io/github/pushrocks/smartchok/badges/code.svg)](https://www.bithound.io/github/pushrocks/smartchok)
2016-11-18 23:36:48 +00:00
[![TypeScript](https://img.shields.io/badge/TypeScript-2.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/)
[![node](https://img.shields.io/badge/node->=%206.x.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/)
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)
## Usage
2018-02-28 23:08:08 +00:00
2017-02-15 20:58:34 +00:00
Use TypeScript for best in class instellisense.
2016-11-18 23:36:48 +00:00
```javascript
2018-02-28 23:08:08 +00:00
import { Smartchok } from 'smartchok';
2016-11-18 23:36:48 +00:00
2018-02-28 23:08:08 +00:00
let mySmartChok = new Smartchok(['some/path/**/*.any', '/absolute/*.js'], chokidarOptions);
2016-11-18 23:36:48 +00:00
2018-02-28 23:08:08 +00:00
mySmartChok.add(['/some/**/*.any']); // add files
2016-11-18 23:36:48 +00:00
2018-02-28 23:08:08 +00:00
mySmartChok.remove('some/**/*.js');
2016-11-18 23:36:48 +00:00
2018-02-28 23:08:08 +00:00
mySmartChok.start(); // starts the watch process
2016-11-18 23:36:48 +00:00
2018-02-28 23:08:08 +00:00
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
});
});
2016-11-18 23:36:48 +00:00
2018-02-28 23:08:08 +00:00
mySmartChok.stop();
2016-11-18 23:36:48 +00:00
```
2017-02-15 20:58:34 +00:00
For further information read the linked docs at the top of this README.
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
2018-02-28 23:08:08 +00:00
> | By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html)
2017-02-15 20:58:34 +00:00
[![repo-footer](https://pushrocks.gitlab.io/assets/repo-footer.svg)](https://push.rocks)