napajs
napajs copied to clipboard
Error: ReferenceError: setTimeout is not defined
The issue occurs when calling zone.broadcastSync();
- exactly here in my codes
zone.broadcastSync(() => {
global.module = require('module');
});
and here inside napajs source code (zone-impl.js file)
ZoneImpl.prototype.broadcastSync = function (arg1, arg2) {
var spec = this.createBroadcastRequest(arg1, arg2);
var result = this._nativeZone.broadcastSync(spec);
if (result.code !== 0) {
throw new Error(result.errorMessage);
}
};
I tried to find a solution without opening a new issue - but it looks like this library does not have a big community so I hope to have a quick help
Module timer
does not work like that in Node.js.
To use timers functions in your module ( that runs in zones), simply use require('timers') in zones will work. for example:
require('timers').setTimeout(...);
@fs-eire what's this ? - I only use the standard functions inside napa .broadcast and .execute these issues maybe inside napa source code - not mine
Module
timer
does not work like that in Node.js.To use timers functions in your module ( that runs in zones), simply use require('timers') in zones will work. for example:
require('timers').setTimeout(...);
@fs-eire I'm running zone.execute inside for loop - do you think , this is the problem ?
this library has some compatibility issues with node version +8.5 it worked well with me after downgrading to (version 8.4.0)