Drop ifvisible as it was only used for Prefetch and that feature was removed in v2.17

This commit is contained in:
the-djmaze 2022-10-10 10:53:04 +02:00
parent 266217434f
commit 689126c57d
4 changed files with 1 additions and 44 deletions

View file

@ -27,8 +27,6 @@ module.exports = {
'SquireUI': "readonly", 'SquireUI': "readonly",
// node_modules/knockout but dev/External/ko.js is used // node_modules/knockout but dev/External/ko.js is used
'ko': "readonly", 'ko': "readonly",
// dev/External/ifvisible.js
'ifvisible': "readonly",
// vendors/routes/ // vendors/routes/
'hasher': "readonly", 'hasher': "readonly",
'Crossroads': "readonly", 'Crossroads': "readonly",

View file

@ -108,7 +108,6 @@ The result is faster and smaller download code (good for mobile networks).
* boot.js without webpack overhead * boot.js without webpack overhead
* Modified Jua.js to be without jQuery * Modified Jua.js to be without jQuery
* Replaced Autolinker with simple https/email detection * Replaced Autolinker with simple https/email detection
* Replaced ifvisible.js with simple drop-in replacement
* Replaced momentToNode with proper HTML5 `<time>` * Replaced momentToNode with proper HTML5 `<time>`
* Replaced resize listeners with ResizeObserver * Replaced resize listeners with ResizeObserver
* Replaced bootstrap.js with native drop-in replacement * Replaced bootstrap.js with native drop-in replacement
@ -119,6 +118,7 @@ The result is faster and smaller download code (good for mobile networks).
* Replaced simplestatemanager with CSS @media * Replaced simplestatemanager with CSS @media
* Replaced inputosaurus with own code * Replaced inputosaurus with own code
* Replaced keymaster with own shortcuts handler * Replaced keymaster with own shortcuts handler
* Removed ifvisible.js
* Removed pikaday * Removed pikaday
* Removed underscore * Removed underscore
* Removed polyfills * Removed polyfills

View file

@ -1,40 +0,0 @@
(doc => {
let idle = 'idle',
visible = 'visible',
status = visible,
timer = 0,
wakeUp = () => {
clearTimeout(timer);
status = visible;
timer = setTimeout(() => {
if (status === visible) {
status = idle;
dispatchEvent(new CustomEvent(idle));
}
}, 10000);
},
init = () => {
init = () => 0;
// Safari
addEventListener('pagehide', () => status = 'hidden');
// Else
doc.addEventListener('visibilitychange', () => {
status = doc.visibilityState;
doc.hidden || wakeUp();
});
wakeUp();
['mousemove','keyup','touchstart'].forEach(t => doc.addEventListener(t, wakeUp));
['scroll','pageshow'].forEach(t => addEventListener(t, wakeUp));
};
this.ifvisible = {
idle: callback => {
init();
addEventListener(idle, callback);
},
now: () => {
init();
return status === visible;
}
};
})(document);

View file

@ -60,7 +60,6 @@ config.paths.js = {
name: 'libs.js', name: 'libs.js',
src: [ src: [
'dev/prototype.js', 'dev/prototype.js',
'dev/External/ifvisible.js',
'dev/dragdropgecko.js', 'dev/dragdropgecko.js',
'dev/shortcuts.js', 'dev/shortcuts.js',
'vendors/routes/hasher.js', 'vendors/routes/hasher.js',