diff --git a/src/native-watcher-registry.js b/src/native-watcher-registry.js index a779f78f5..0fffe4f77 100644 --- a/src/native-watcher-registry.js +++ b/src/native-watcher-registry.js @@ -431,6 +431,14 @@ class NativeWatcherRegistry { watcher.attachToNative(native, nativePath) }) } + + // Private: Generate a visual representation of the currently active watchers managed by this + // registry. + // + // Returns a {String} showing the tree structure. + print() { + return this.tree.print() + } } module.exports = {NativeWatcherRegistry} diff --git a/src/path-watcher.js b/src/path-watcher.js index 011aa508b..88f9cd77d 100644 --- a/src/path-watcher.js +++ b/src/path-watcher.js @@ -581,6 +581,11 @@ class PathWatcherManager { return watcher } + // Private: Return a {String} depicting the currently active native watchers. + print () { + return this.nativeRegistry.print() + } + // Private: Stop all living watchers. // // Returns a {Promise} that resolves when all native watcher resources are disposed. @@ -641,4 +646,9 @@ function stopAllWatchers () { return PathWatcherManager.instance().stopAllWatchers() } -module.exports = {watchPath, stopAllWatchers} +// Private: Show the currently active native watchers. +function printWatchers () { + return PathWatcherManager.instance().print() +} + +module.exports = {watchPath, stopAllWatchers, printWatchers}