mjolnir._asm.pathwatcher

Home: https://github.com/asmagill/mjolnir_asm.watcher

Watch paths recursively for changes.

This simple example watches your Hydra directory for changes, and when it sees a change, reloads your configs:

watcher.path.new(os.getenv("HOME") .. "/.hydra/", hydra.reload):start()

This module is based primarily on code from the previous incarnation of Mjolnir by Steven Degutis.

new

mjolnir._asm.pathwatcher.new(path, fn) -> watcher

Returns a new watcher.path that can be started and stopped. The function registered receives as it's argument, a table containing a list of the files which have changed since it was last invoked.

start

mjolnir._asm.pathwatcher:start()

Registers watcher's fn as a callback for when watcher's path or any descendent changes.

stop

mjolnir._asm.pathwatcher:stop()

Unregisters watcher's fn so it won't be called again until the watcher is restarted.