metro-memory-fs: implement watcher persistent option

Reviewed By: mjesun

Differential Revision: D7890835

fbshipit-source-id: b6a4e9aea1095dedd44e5ea341ad5fcf0ebd136e
This commit is contained in:
Jean Lauliac 2018-05-08 12:54:20 -07:00 committed by Facebook Github Bot
parent 5f6ada9e8b
commit bfcf4e32d9
1 changed files with 5 additions and 0 deletions

View File

@ -1079,6 +1079,7 @@ class FSWatcher extends EventEmitter {
_encoding: Encoding;
_node: EntityNode;
_nodeWatcher: NodeWatcher;
_persistIntervalId: IntervalID;
constructor(
node: EntityNode,
@ -1092,10 +1093,14 @@ class FSWatcher extends EventEmitter {
};
node.watchers.push(this._nodeWatcher);
this._node = node;
if (options.persistent) {
this._persistIntervalId = setInterval(() => {}, 60000);
}
}
close() {
this._node.watchers.splice(this._node.watchers.indexOf(this._nodeWatcher));
clearInterval(this._persistIntervalId);
}
_listener = (eventType, filePath: string) => {