<commit_before>/*
 * This file is part of yoob.js version 0.5-PRE
 * Available from https://github.com/catseye/yoob.js/
 * This file is in the public domain.  See http://unlicense.org/ for details.
 */
if (window.yoob === undefined) yoob = {};

/*
 * Pretty standard shim to get window.{request,cancelRequest}AnimationFrame
 * functions, synthesized from the theory and the many examples I've seen.
 */

window.requestAnimationFrame =
    window.requestAnimationFrame ||
    window.webkitRequestAnimationFrame ||
    window.mozRequestAnimationFrame ||
    window.oRequestAnimationFrame ||
    window.msRequestAnimationFrame ||
    function(f, elem) {
        return setTimeout(function() {
            f(Date.now());
        }, 1000 / 60);
    };

window.cancelRequestAnimationFrame =
    window.cancelRequestAnimationFrame ||
    window.webkitCancelRequestAnimationFrame ||
    window.mozCancelRequestAnimationFrame ||
    window.oCancelRequestAnimationFrame ||
    window.msCancelRequestAnimationFrame ||
    clearTimeout;
<commit_msg>Backport setUp{Quantum,Proportional}AnimationFrame() from gewgaws.<commit_after>/*
 * This file is part of yoob.js version 0.5-PRE
 * Available from https://github.com/catseye/yoob.js/
 * This file is in the public domain.  See http://unlicense.org/ for details.
 */
if (window.yoob === undefined) yoob = {};

/*
 * Pretty standard shim to get window.{request,cancelRequest}AnimationFrame
 * functions, synthesized from the theory and the many examples I've seen.
 */

window.requestAnimationFrame =
    window.requestAnimationFrame ||
    window.webkitRequestAnimationFrame ||
    window.mozRequestAnimationFrame ||
    window.oRequestAnimationFrame ||
    window.msRequestAnimationFrame ||
    function(f, elem) {
        return setTimeout(function() {
            f(Date.now());
        }, 1000 / 60);
    };

window.cancelRequestAnimationFrame =
    window.cancelRequestAnimationFrame ||
    window.webkitCancelRequestAnimationFrame ||
    window.mozCancelRequestAnimationFrame ||
    window.oCancelRequestAnimationFrame ||
    window.msCancelRequestAnimationFrame ||
    clearTimeout;

/*
 * Convenience function for using requestAnimationFrame.  Calls the
 * object's draw() method on each animation frame, and calls update()
 * as necessary to ensure it is called once every tickTime milliseconds.
 * By default, tickTime = 1/60th of a second.  It can be configured by
 * passing in a configuration dictionary after the object.  If the
 * configuration dictionary is assigned to a variable outside this
 * function, after this function returns, the request entry in the
 * dictionary will contain the animation request handle.  e.g.,
 *
 *     var cfg = {};
 *     cfg.tickTime = 1000.0 / 50.0;
 *     yoob.setUpQuantumAnimationFrame(this, cfg);
 *     cancelRequestAnimationFrame(cfg.request);
 *
 */
yoob.setUpQuantumAnimationFrame = function(object, cfg) {
    cfg = cfg || {};
    cfg.lastTime = cfg.lastTime || null;
    cfg.accumDelta = cfg.accumDelta || 0;
    cfg.tickTime = cfg.tickTime || (1000.0 / 60.0);
    var animFrame = function(time) {
        object.draw();
        if (cfg.lastTime === null) {
            cfg.lastTime = time;
        }
        cfg.accumDelta += (time - cfg.lastTime);
        while (cfg.accumDelta > cfg.tickTime) {
            cfg.accumDelta -= cfg.tickTime;
            object.update();
        }
        cfg.lastTime = time;
        cfg.request = requestAnimationFrame(animFrame);
    };
    cfg.request = requestAnimationFrame(animFrame);
};

/*
 * Convenience function for using requestAnimationFrame.  Calls the
 * object's draw() method on each animation frame, passing the amount
 * of time that has elapsed (in milliseconds) since the last time it
 * was called (or 0 if it was never previously called.)  Otherwise
 * similar to yoob.setUpQuantumAnimationFrame.
 */
yoob.setUpProportionalAnimationFrame = function(object, cfg) {
    cfg = cfg || {};
    cfg.lastTime = cfg.lastTime || null;
    var animFrame = function(time) {
        var timeElapsed = cfg.lastTime == null ? 0 : time - cfg.lastTime;
        cfg.lastTime = time;
        object.draw(timeElapsed);
        cfg.request = requestAnimationFrame(animFrame);
    };
    cfg.request = requestAnimationFrame(animFrame);
};

{'fraction_non_alphanumeric': 0.10390826117481863, 'fraction_numerical': 0.00889304937982682, 'mean_word_length': 3.295477386934673, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5420767', 'n_tokens_mistral': 1211, 'n_tokens_neox': 1158, 'n_words': 323}