• Jump To … +
    CONTRIBUTING.md MIT-LICENSE.md README.js.md audio.js audio/null_sound.js audio/sound.js audio/sound_instance.js core.js graphics.js graphics/animation.js graphics/canvas.js graphics/image.js graphics/sprite.js graphics/sprite_sheet.js keyboard.js media.js mouse.js timer.js timer/after.js timer/every.js timer/tween.js touch.js
  • ¶

    timer/after.js

    (function() {
  • ¶

    Luv.Timer.After

    Luv.Timer.After = Luv.Class('Luv.Timer.After', {
    
      init: function(timeToCall, callback, context) {
        this.timeRunning = 0;
        this.timeToCall  = timeToCall;
        this.callback    = callback;
        this.context     = context;
      },
    
      update: function(dt) {
        this.timeRunning += dt;
        var diff = this.timeRunning - this.timeToCall;
        if(diff >= 0) {
          this.callback.call(this.context, diff);
          return true;
        }
        return false;
      }
    
    });
    
    }());