kompendium
Version:
Documentation generator for Stencil components
15 lines (12 loc) • 324 B
text/typescript
import chokidar from 'chokidar';
import nodeCleanup from 'node-cleanup';
export function createWatcher(
path: string,
type: string,
callback: (...args: any[]) => void,
): void {
const watcher = chokidar.watch(path).on(type, callback);
nodeCleanup(async () => {
await watcher.close();
});
}