/*
* @title (N/sec)
* @description timer throttling checker w/ await
* @include *
* @license MIT License https://opensource.org/licenses/MIT
* @javascript_url
*/
// background tab throttling
// Firefox 57.0.4 | N/~1sec
// Chromium 63.0.3239.108 | N/~2sec
(async () => {
'use strict';
const sleep = (wait = 1 * 1000) => {
return new Promise(res => setTimeout(res, wait));
};
let _title = document.title;
const n = 100;
for (let i = 0; i < n; i += 1) {
const remain = String(n - i).padStart(String(n).length, '0');
const time = new Date().toTimeString().slice(0, 8);
document.title = [
'(' + remain + ')',
time,
'-',
_title,
].join(' ');
console && console.debug && console.debug(remain, time);
await sleep();
}
document.title = _title;
})();