Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /netdata/web/gui/src/dashboard.js/ drwxr-xr-x | |
| Viewing file: Select action/file-type:
// *** src/dashboard.js/timeout.js
// TODO: Better name needed
NETDATA.timeout = {
// by default, these are just wrappers to setTimeout() / clearTimeout()
step: function (callback) {
return window.setTimeout(callback, 1000 / 60);
},
set: function (callback, delay) {
return window.setTimeout(callback, delay);
},
clear: function (id) {
return window.clearTimeout(id);
},
init: function () {
let custom = true;
if (window.requestAnimationFrame) {
this.step = function (callback) {
return window.requestAnimationFrame(callback);
};
this.clear = function (handle) {
return window.cancelAnimationFrame(handle.value);
};
// } else if (window.webkitRequestAnimationFrame) {
// this.step = function (callback) {
// return window.webkitRequestAnimationFrame(callback);
// };
// if (window.webkitCancelAnimationFrame) {
// this.clear = function (handle) {
// return window.webkitCancelAnimationFrame(handle.value);
// };
// } else if (window.webkitCancelRequestAnimationFrame) {
// this.clear = function (handle) {
// return window.webkitCancelRequestAnimationFrame(handle.value);
// };
// }
// } else if (window.mozRequestAnimationFrame) {
// this.step = function (callback) {
// return window.mozRequestAnimationFrame(callback);
// };
// this.clear = function (handle) {
// return window.mozCancelRequestAnimationFrame(handle.value);
// };
// } else if (window.oRequestAnimationFrame) {
// this.step = function (callback) {
// return window.oRequestAnimationFrame(callback);
// };
// this.clear = function (handle) {
// return window.oCancelRequestAnimationFrame(handle.value);
// };
// } else if (window.msRequestAnimationFrame) {
// this.step = function (callback) {
// return window.msRequestAnimationFrame(callback);
// };
// this.clear = function (handle) {
// return window.msCancelRequestAnimationFrame(handle.value);
// };
} else {
custom = false;
}
if (custom) {
// we have installed custom .step() / .clear() functions
// overwrite the .set() too
this.set = function (callback, delay) {
let start = Date.now(),
handle = new Object();
const loop = () => {
let current = Date.now(),
delta = current - start;
if (delta >= delay) {
callback.call();
} else {
handle.value = this.step(loop);
}
}
handle.value = this.step(loop);
return handle;
};
}
}
};
NETDATA.timeout.init();
|
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0052 ]-- |