How to use the watchr.Watcher function in watchr

To help you get started, we’ve selected a few watchr examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github avaer / archae / index.js View on Github external
.then(pluginPath => {
          const match = pluginPath.match(/^file:(.+)$/);
          if (match) {
            pluginPath = match[1];

            const watcher = new watchr.Watcher(pluginPath);
            watcher.setConfig({
              catchupDelay: 100,
            });
            const change = (/*changeType, fullPath, currentStat, previousStat*/) => {
              this.broadcast('unload', plugin);

              this.removePlugin(plugin)
                .then(() => {
                  this.broadcast('load', plugin);

                  return this.requestPlugin(plugin, {
                    hotload: true,
                  });
                })
                .catch(err => {
                  console.warn(err);

watchr

Better file system watching for Node.js

MIT
Latest version published 3 years ago

Package Health Score

57 / 100
Full package analysis