← 教程列表
news

File Watching

📅 2026/6/12 16:30:02⏱ 约 5 分钟阅读👁 8 阅读

`fs.watch(SCREEN_DIR)` replaces chokidar. On HTML file events: - On new file (`rename` event for a file that exists): delete `.events` file if present (`unlinkSync`), log `screen-added` to stdout as JSON - On file change (`change` event): log `screen-updated` to stdout as JSON (do NOT clear `.events`) - Both events: send `{ type: 'reload' }` to all connected WebSocket clients Debounce per-filename with ~100ms timeout to prevent duplicate events (common on macOS and Linux).

← 返回教程列表 AI8899 · 内容仅供学习参考