content.watch()

Keep the manifest and cache in sync with source file changes.

content.watch()

Subscribes to every watchable source and keeps the manifest and cache in sync with file changes, firing the watch:file:update and watch:file:remove hooks after each change is applied.

Parameters: none.

Returns: Promise<() => Promise<void>>, an async stop function that unsubscribes every source at once.

usage.ts
const stop = await content.watch()
// later:
await stop()

A source fires watch hooks only if its driver supports watching: the fs source watches via chokidar; github does not. Reads still work either way.

Usage

usage.ts
const stop = await content.watch()
await stop()