Sha256: 0a3c03ef11d5fea4b7e247bcac66021b681ccdfcba994e1d356aaf3c02205593

Contents?: true

Size: 724 Bytes

Versions: 7

Compression:

Stored size: 724 Bytes

Contents

/*global Class */

// Timer class for use with auto-updating of game status'.
window.Timer = Class.extend({
    initialize: function(func, period) {
        this.func = func;

        if (!period) {
            console.warn('## Timer: period arg not set. Using 30s for interval');
            this.period = 30000;
        } else {
            this.period = period;
        }
        this.interval = null;
    },
    // startNow: function() {
    //     this.func();
    //     this.interval = window.setInterval(this.func, this.period);
    // },
    start: function() {
        this.interval = window.setInterval(this.func, this.period);
    },
    stop: function() {
        window.clearInterval(this.interval);
    }
});

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
sports_db-0.2.19 app/assets/javascripts/core/Timer.js
sports_db-0.2.18 app/assets/javascripts/core/Timer.js
sports_db-0.2.17 app/assets/javascripts/core/Timer.js
sports_db-0.2.16 app/assets/javascripts/core/Timer.js
sports_db-0.2.15 app/assets/javascripts/core/Timer.js
sports_db-0.2.14 app/assets/javascripts/core/Timer.js
sports_db-0.2.13 app/assets/javascripts/core/Timer.js