sync delay not working
Closed this issue · 0 comments
GiulianoReginatto commented
I would like to know if it is possible to use synchronous delay together with the focusWindow function, whenever I try to use it, the program executes the delays as requested but the program is only focused on finishing all delays.
const processWindows = require("node-process-windows");
function wait(ms, cb) {
var waitDateOne = new Date();
while ((new Date()) - waitDateOne <= ms) {
//Nothing
}
if (cb) {
eval(cb);
}
}
console.log('1');
wait(1000);
processWindows.focusWindow("chrome"); // focus window expected here
wait(1000);
console.log('2');
wait(1000);
console.log('3')
// focus window execute here