This repository has been archived by the owner on Jan 15, 2021. It is now read-only.
forked from jxcore/jxcore
-
Notifications
You must be signed in to change notification settings - Fork 4
Can't overwrite global setTimeout
and setInterval
in jxcore
#86
Comments
The issue comes from here and here. // TODO(obastemur) check ION again and remove the below hack or fix it.
// -- I personally suspect ION skips it mostly because of multiple references
// to globals?
//
// experimental hack
// ionSpew may skip ION compilation when there is a global member used.
// sending the popular references: setTimeout, setInterval, and process
var args = [self.exports, require, self, filename, dirname,
global.setTimeout, global.setInterval, global.process];
return compiledWrapper.apply(self.exports, args); NativeModule.wrapper = [
'(function (exports, require, module, __filename, __dirname, ' +
'setTimeout, setInterval, process) { ',
'\n});']; In jxcore |
One more difference between node and jxcore: var timers = require('timers');
console.log(global.setTimeout === timers.setTimeout); jxcore prints |
opetkevich
added a commit
to thaliproject/Thali_CordovaPlugin
that referenced
this issue
Mar 24, 2017
… sinon config using sandbox with issue (thaliproject/jxcore#86)
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Test case:
Output:
I've discovered it when trying to use sinon's fake timers. They simply doesn't work in jxcore. It affects at least
setTimeout
andsetInterval
functions. Other global variables (likeDate
,Number
,setImmediate
) are fine.I'm not sure about priority of this bug. I had to change
setTimeout
toglobal.setTimeout
everywhere in my code in order to make everything work. So for now I can use this workaround.The text was updated successfully, but these errors were encountered: