<commit_before>/**
 * @module js-utils/js/repeater
 */
define([
    'underscore'
], function () {
    /**
     * @name module:js-utils/js/repeater.Repeater
     * @desc Wrapper around setTimeout that allows for the control of the timeout
     * @param {function} f The function to be called
     * @param {number} interval The number of milliseconds between invocations of f
     * @constructor
     */
    function Repeater(f, interval) {
        this.f = f;
        this.interval = interval;
        this.timeout = null;
        this.update = _.bind(this.update, this);
    }

    _.extends(Repeater.prototype, /** @lends module:js-utils/js/repeater.Repeater.prototype */{
        /**
         * @desc Stops the timeout
         * @returns {Repeater} this
         */
        stop: function () {
            if (this.timeout !== null) {
                clearTimeout(this.timeout);
                this.timeout = null;
            }

            return this;
        },

        /**
         * @desc Starts the timeout. If it has already started, this will reset the timeout
         * @returns {Repeater} this
         */
        start: function () {
            this.stop();
            this.timeout = _.delay(this.update, this.interval);
            return this;<commit_msg>Use correct method name. [rev: matthew.gordon2]<commit_after>/**
 * @module js-utils/js/repeater
 */
define([
    'underscore'
], function () {
    /**
     * @name module:js-utils/js/repeater.Repeater
     * @desc Wrapper around setTimeout that allows for the control of the timeout
     * @param {function} f The function to be called
     * @param {number} interval The number of milliseconds between invocations of f
     * @constructor
     */
    function Repeater(f, interval) {
        this.f = f;
        this.interval = interval;
        this.timeout = null;
        this.update = _.bind(this.update, this);
    }

    _.extend(Repeater.prototype, /** @lends module:js-utils/js/repeater.Repeater.prototype */{
        /**
         * @desc Stops the timeout
         * @returns {Repeater} this
         */
        stop: function () {
            if (this.timeout !== null) {
                clearTimeout(this.timeout);
                this.timeout = null;
            }

            return this;
        },

        /**
         * @desc Starts the timeout. If it has already started, this will reset the timeout
         * @returns {Repeater} this
         */
        start: function () {
            this.stop();
            this.timeout = _.delay(this.update, this.interval);
            return this;
{'fraction_non_alphanumeric': 0.11703360370799537, 'fraction_numerical': 0.0003862495171881035, 'mean_word_length': 1.803030303030303, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '2085323', 'n_tokens_mistral': 733, 'n_tokens_neox': 718, 'n_words': 198}