VVincentLee0211发布于 12 年前
019890
有如下代码
'use strict';
const
fs = require('fs'),
filename = process.argv[2];
if (!filename) {
throw Error('bababa...');
}
fs.watch(filename, function(event, filename) {
console.log('bababa...');
});
console.log('bababa...');
// 在这个时间段内的事件触发之后, 没有任何结果?
const startTime = new Date().getTime();
while (new Date().getTime() < startTime + 5000);
在while执行的事件段内触发的fs.watch事件, 为什么没有结果? 是不是说, 在主进程执行的过程中, 所有触发的事件都没有效果?