(N/sec)

    
      
  • /*
     * @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;
    })();
    
    
  • Permalink
    このページへの個別リンクです。
    RAW
    書かれたコードへの直接のリンクです。
    Packed
    文字列が圧縮された書かれたコードへのリンクです。
    Userscript
    Greasemonkey 等で利用する場合の .user.js へのリンクです。
    Loader
    @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
    Metadata
    コード中にコメントで @xxx と書かれたメタデータの JSON です。

History

  1. 2018/01/09 09:23:05 - 2018-01-09
  2. 2018/01/07 00:55:32 - 2018-01-07
  3. 2018/01/06 13:06:58 - 2018-01-06
  4. 2018/01/06 07:37:58 - 2018-01-06
  5. 2018/01/06 07:29:24 - 2018-01-06