MCPcopy Index your code
hub / github.com/browserify/watchify / watchFile

Function watchFile

index.js:104–124  ·  view source on GitHub ↗
(file, dep)

Source from the content-addressed store, hash-verified

102 });
103
104 function watchFile (file, dep) {
105 dep = dep || file;
106 if (ignored) {
107 if (!ignoredFiles.hasOwnProperty(file)) {
108 ignoredFiles[file] = anymatch(ignored, file);
109 }
110 if (ignoredFiles[file]) return;
111 }
112 if (!fwatchers[file]) fwatchers[file] = [];
113 if (!fwatcherFiles[file]) fwatcherFiles[file] = [];
114 if (fwatcherFiles[file].indexOf(dep) >= 0) return;
115
116 var w = b._watcher(dep, wopts);
117 w.setMaxListeners(0);
118 w.on('error', b.emit.bind(b, 'error'));
119 w.on('change', function () {
120 invalidate(file);
121 });
122 fwatchers[file].push(w);
123 fwatcherFiles[file].push(dep);
124 }
125
126 function invalidate (id) {
127 if (cache) delete cache[id];

Callers 1

watchifyFunction · 0.85

Calls 1

invalidateFunction · 0.85

Tested by

no test coverage detected