EdwardZZZ / articles

工作点滴记录
2 stars 0 forks source link

framed #46

Open EdwardZZZ opened 6 years ago

EdwardZZZ commented 6 years ago

const log = (n) => {
            console.log(n, new Date());
        }

        const rAF = window.requestAnimationFrame    ||
            window.webkitRequestAnimationFrame      ||
            window.mozRequestAnimationFrame         ||
            window.oRequestAnimationFrame           ||
            window.msRequestAnimationFrame          ||
            function (callback) { window.setTimeout(callback, 1000 / 60); };

        const framed = (fn, ...props) => {
            rAF(framed.bind(this, fn, ...props));
            fn.bind(this)(...props);
        }

        framed(log, 1);