mirror of
https://github.com/gorhill/uBlock.git
synced 2024-10-04 16:47:15 +02:00
Drop requestIdleCallback
from globals
Related discussion: - https://github.com/gorhill/uBlock/pull/3839 `requestIdleCallback` can be assumed always present on browser-related platforms.
This commit is contained in:
parent
68675ed1cd
commit
19160f9018
@ -382,8 +382,8 @@ const onFilterChanged = (( ) => {
|
||||
};
|
||||
|
||||
return function() {
|
||||
if ( timer !== undefined ) { globals.cancelIdleCallback(timer); }
|
||||
timer = globals.requestIdleCallback(process, { timeout: 773 });
|
||||
if ( timer !== undefined ) { self.cancelIdleCallback(timer); }
|
||||
timer = self.requestIdleCallback(process, { timeout: 773 });
|
||||
};
|
||||
})();
|
||||
|
||||
@ -555,8 +555,8 @@ const onTextChanged = (( ) => {
|
||||
};
|
||||
|
||||
return function(now) {
|
||||
if ( timer !== undefined ) { globals.cancelIdleCallback(timer); }
|
||||
timer = now ? process() : globals.requestIdleCallback(process, { timeout: 57 });
|
||||
if ( timer !== undefined ) { self.cancelIdleCallback(timer); }
|
||||
timer = now ? process() : self.requestIdleCallback(process, { timeout: 57 });
|
||||
};
|
||||
})();
|
||||
|
||||
|
@ -35,21 +35,6 @@ const globals = (( ) => {
|
||||
// jshint ignore:end
|
||||
})();
|
||||
|
||||
// https://en.wikipedia.org/wiki/.invalid
|
||||
if ( globals.location === undefined ) {
|
||||
globals.location = new URL('https://ublock0.invalid/');
|
||||
}
|
||||
|
||||
// https://developer.mozilla.org/en-US/docs/Web/API/Window/requestIdleCallback
|
||||
if ( globals.requestIdleCallback === undefined ) {
|
||||
globals.requestIdleCallback = function(callback) {
|
||||
return globals.setTimeout(callback, 1);
|
||||
};
|
||||
globals.cancelIdleCallback = function(handle) {
|
||||
return globals.clearTimeout(handle);
|
||||
};
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
export default globals;
|
||||
|
Loading…
Reference in New Issue
Block a user