| 84 | ) |
| 85 | |
| 86 | const callback: ParcelWatcher.SubscribeCallback = (_error, updates) => { |
| 87 | for (const update of updates) { |
| 88 | if (update.type === "create") runFork(events.publish(Event.Updated, { file: update.path, event: "add" })) |
| 89 | if (update.type === "update") runFork(events.publish(Event.Updated, { file: update.path, event: "change" })) |
| 90 | if (update.type === "delete") runFork(events.publish(Event.Updated, { file: update.path, event: "unlink" })) |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | const subscribe = (directory: string, ignore: string[]) => { |
| 95 | const pending = w.subscribe(directory, callback, { ignore, backend }) |