DirectoryWatcher:Destroy Synchronous

Stop a directory watcher. OnChanged fires no more events and its signal is destroyed.

Syntax
Luau
DirectoryWatcher:Destroy() -> ()

Parameters

Call this method with a DirectoryWatcher receiver. The colon supplies self implicitly; a dot call must pass the receiver explicitly.

This function takes no arguments.

Returns

()

No values.

Usage notes

Calling Destroy again does nothing. Changes made after Destroy are not reported.

Example

Example
Luau
makefolder("watched-once")
local watcher = DirectoryWatcher.new("watched-once")
watcher:Destroy()
writefile("watched-once/ignored.txt", "not reported")
delfolder("watched-once")