MCPcopy Index your code
hub / github.com/nodejs/node / watchFile

Function watchFile

test/fixtures/snapshot/typescript.js:6259–6276  ·  view source on GitHub ↗
(fileName, callback, defaultPollingInterval)

Source from the content-addressed store, hash-verified

6257 var highPollingIntervalQueue = createPollingIntervalQueue(PollingInterval.High);
6258 return watchFile;
6259 function watchFile(fileName, callback, defaultPollingInterval) {
6260 var file = {
6261 fileName: fileName,
6262 callback: callback,
6263 unchangedPolls: 0,
6264 mtime: getModifiedTime(host, fileName)
6265 };
6266 watchedFiles.push(file);
6267 addToPollingIntervalQueue(file, defaultPollingInterval);
6268 return {
6269 close: function () {
6270 file.isClosed = true;
6271 // Remove from watchedFiles
6272 ts.unorderedRemoveItem(watchedFiles, file);
6273 // Do not update polling interval queue since that will happen as part of polling
6274 }
6275 };
6276 }
6277 function createPollingIntervalQueue(pollingInterval) {
6278 var queue = [];
6279 queue.pollingInterval = pollingInterval;

Calls 11

getModifiedTimeFunction · 0.85
scheduleNextPollFunction · 0.85
fsWatchFunction · 0.85
nonPollingWatchFileFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected