我们用我们的项目require.js,我们需要重写的setTimeout在行705,这是我们需要忽略/都忽略莫名其妙此的setTimeout(代码我的意思是运行它),如果我改变它在开放源代码显式更改版本时代码将会丢失的问题,我应该如何从外部重写此setTimout只为require.js文件并保持它很长时间当我使用这个库,是否有可能在优雅方式在JS全球?覆盖的setTimeout
https://github.com/jrburke/requirejs/blob/master/require.js
这是行705
//If still waiting on loads, and the waiting load is something
//other than a plugin resource, or there are still outstanding
//scripts, then just try back later.
if ((!expired || usingPathFallback) && stillLoading) {
//Something is still waiting to load. Wait for it, but only
//if a timeout is not already in effect.
if ((isBrowser || isWebWorker) && !checkLoadedTimeoutId) {
checkLoadedTimeoutId = setTimeout(function() {
checkLoadedTimeoutId = 0;
checkLoaded();
}, 50);
}
}
仅供参考,我们做的是 Chrome: timeouts/interval suspended in background tabs?
这戒指我所有的警钟,为什么你需要做的呢?改变全球功能和对象几乎从来都不是一个好主意。 –
@MadaraUchiha - 当我们在非活动选项卡上使用require.js(我的意思是在打开新窗口后),每个服务负载需要一秒钟后,查看我提供给setTimout的链接! –
但是,它处于非活动状态,用户不在观看,您为什么关心需要多长时间? –