code: function setIntervalContext(fn, ctx, timeout) {
    var id;
  
    var cancel = function() {
      clearInterval(id);
    };
  
    id = setInterval(function() { fn(); }, timeout);
  
    ctx.once('cancel', cancel);
  }
docs: Set interval with cancel support