(server: RuntimeServer, fsWatches: Map<string, FsWatchState>, watchId: string)
| 48 | } |
| 49 | |
| 50 | function stopWatch(server: RuntimeServer, fsWatches: Map<string, FsWatchState>, watchId: string): { ok: true; dir: string } | { ok: false; error: string } { |
| 51 | const watch = fsWatches.get(watchId) |
| 52 | if (!watch) return { ok: false, error: "watch not found" } |
| 53 | watch.watcher.close() |
| 54 | clearInterval(watch.poller) |
| 55 | fsWatches.delete(watchId) |
| 56 | server.notify("fs/watch/stopped", { watchId, dir: watch.dir, at: new Date().toISOString() }) |
| 57 | return { ok: true, dir: watch.dir } |
| 58 | } |
| 59 | |
| 60 | export function registerRuntimeNodeFsWatchModule(server: RuntimeServer): () => void { |
| 61 | const fsWatches = new Map<string, FsWatchState>() |
no test coverage detected