function handleWatchEvent
handleWatchEvent(
config: Config,
extensions: string[],
event: string,
filePath: string,
onEventFunc: (
event: string,
file: string
) => unknown
,
onFinishFunc: ((
path: string,
event: string
) => void) | null | undefined
): void

Routes a file-system event to fsTree mutation and optional rebuild trigger. unlinkDir bypasses the extension filter so deleted directories always clean up fsTree.

Parameters

config: Config
extensions: string[]
event: string
filePath: string
onEventFunc: (
event: string,
file: string
) => unknown
onFinishFunc: ((
path: string,
event: string
) => void) | null | undefined

Return Type

void

Usage

import { handleWatchEvent } from "lib/setup/file-watcher.ts";