28 lines
1.2 KiB
Plaintext
28 lines
1.2 KiB
Plaintext
var dmon = this
|
|
|
|
dmon.watch[cell.DOC] = `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.
|
|
|
|
:return: None
|
|
:throws: An error if dmon is already watching.
|
|
`
|
|
|
|
dmon.unwatch[cell.DOC] = `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.
|
|
|
|
:return: None
|
|
:throws: An error if no directory is currently being watched.
|
|
`
|
|
|
|
dmon.poll[cell.DOC] = `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).
|
|
|
|
:param callback: A function to call for each event, receiving an event object as its argument.
|
|
:return: None
|
|
`
|
|
|
|
return dmon
|