From e2c9cc16924d86997bb129eee0cc8d3d955eaade Mon Sep 17 00:00:00 2001 From: Ash Wilson Date: Fri, 18 Aug 2017 09:08:34 -0400 Subject: [PATCH] Private diagnostic method to dump the active watchers --- src/native-watcher-registry.js | 8 ++++++++ src/path-watcher.js | 12 +++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) 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}