All checks were successful
Build and Deploy / build-linux (push) Successful in 1m11s
Build and Deploy / build-windows (CLANG64) (push) Successful in 13m30s
Build and Deploy / package-dist (push) Has been skipped
Build and Deploy / deploy-itch (push) Has been skipped
Build and Deploy / deploy-gitea (push) Has been skipped
40 lines
1.2 KiB
Markdown
40 lines
1.2 KiB
Markdown
# dmon
|
|
|
|
### watch() <sub>function</sub>
|
|
|
|
Start watching the root directory, recursively.
|
|
|
|
This function begins monitoring the specified directory and its subdirectories recursively for events such as file creation, deletion, modification, or movement. Events are queued and can be retrieved by calling poll.
|
|
|
|
:throws: An error if dmon is already watching.
|
|
|
|
|
|
**Returns**: None
|
|
|
|
|
|
### unwatch() <sub>function</sub>
|
|
|
|
Stop watching the currently monitored directory.
|
|
|
|
This function halts filesystem monitoring for the directory previously set by watch. It clears the watch state, allowing a new watch to be started.
|
|
|
|
:throws: An error if no directory is currently being watched.
|
|
|
|
|
|
**Returns**: None
|
|
|
|
|
|
### poll(callback) <sub>function</sub>
|
|
|
|
Retrieve and process queued filesystem events.
|
|
|
|
This function dequeues all pending filesystem events and invokes the provided callback for each one. The callback receives an event object with properties: 'action' (string: "create", "delete", "modify", or "move"), 'root' (string: watched directory), 'file' (string: affected file path), and 'old' (string: previous file path for move events, empty if not applicable).
|
|
|
|
|
|
|
|
**callback**: A function to call for each event, receiving an event object as its argument.
|
|
|
|
|
|
**Returns**: None
|
|
|