we are using require.js
in our project and we need to override the setTimeout
in line 1802, this is the code which we need to set to 0 or ignore somehow this setTimeout at all(I mean ru over it) ,the problem that if I change it in the open source code explicit when I change version the code will be lost,how should I override this setTimout
from outside only for the require.js file and keep it as long as I use this lib, is it possible to do it in elegant way in JS?
/**
* Execute something after the current tick
* of the event loop. Override for other envs
* that have a better solution than setTimeout.
* @param {Function} fn function to execute later.
*/
req.nextTick = typeof setTimeout !== 'undefined' ? function (fn) {
setTimeout(fn, 4);
} : function (fn) { fn(); };
This is the link for the require.js open source in Git https://github.com/jrburke/requirejs/blob/master/require.js line 1802