watch-dependency-graph
Version:
[](https://www.npmjs.com/package/watch-dependency-graph) [ • 1.22 kB
Markdown
[](https://www.npmjs.com/package/watch-dependency-graph) [](https://coveralls.io/github/sure-thing/watch-dependency-graph?branch=main) [](https://packagephobia.com/result?p=watch-dependency-graph)
A small Node.js file watcher that watches dependency trees instead of globs or
directories.
```js
import { create } from 'watch-dependency-graph'
const files = [path.resolve(__dirname, './my-file.js')]
const watcher = create()
watcher.on('change', (files) => {}) // string[]
watcher.on('remove', (files) => {}) // string[]
watcher.on('error', (error) => {}) // string[]
watcher.add(files) // string or string[], must be absolute
watcher.remove(files) // string or string[], must be absolute
const removeListener = watcher.on('change', (files) => {})
removeListener()
```
MIT License © [Sure Thing](https://github.com/sure-thing)