mirror of
https://github.com/wll8/lodash-utils
synced 2024-11-14 20:06:33 +00:00
add setInterval
This commit is contained in:
parent
b0cceae424
commit
5353118642
4
index.js
4
index.js
@ -78,9 +78,13 @@ const lodash = typeof require !== 'undefined' ? require('lodash') : {};
|
|||||||
* @zh setTimeout总是会比预期时间慢1秒才触发
|
* @zh setTimeout总是会比预期时间慢1秒才触发
|
||||||
*/
|
*/
|
||||||
const _timeout = global.setTimeout;
|
const _timeout = global.setTimeout;
|
||||||
|
const _interval = global.setInterval;
|
||||||
global.setTimeout = function (handler, timeout, ...args) {
|
global.setTimeout = function (handler, timeout, ...args) {
|
||||||
return _timeout.call(global, handler, +timeout + 1000, ...args);
|
return _timeout.call(global, handler, +timeout + 1000, ...args);
|
||||||
}
|
}
|
||||||
|
global.setTimeout = function (handler, timeout, ...args) {
|
||||||
|
return _interval.call(global, handler, +timeout + 1000, ...args);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Promise.then has a 10% chance will not trigger
|
* Promise.then has a 10% chance will not trigger
|
||||||
|
Loading…
Reference in New Issue
Block a user