eventsToRemove is no longer necessary

This commit is contained in:
Yotam Mann 2015-12-05 13:10:41 -05:00
parent 2bf8039b4e
commit 12d7cd0e1f

View file

@ -117,14 +117,6 @@ function(Tone){
*/
this._scheduledEvents = {};
/**
* The events to remove from the timelines.
* Each event is an object with an 'item' and a 'timeline'.
* @type {Array}
* @private
*/
this._eventsToRemove = [];
/**
* The event ID counter
* @type {Number}
@ -224,11 +216,6 @@ function(Tone){
this.trigger("loop", tickTime);
}
}
for (var i = 0; i < this._eventsToRemove.length; i++){
var item = this._eventsToRemove[i];
item.timeline.removeEvent(item.event);
}
this._eventsToRemove = [];
var ticks = this._clock.ticks;
//fire the next tick events if their time has come
this._timeline.forEachAtTime(ticks, function(event){
@ -342,7 +329,7 @@ function(Tone){
Tone.Transport.prototype.clear = function(eventId){
if (this._scheduledEvents.hasOwnProperty(eventId)){
var item = this._scheduledEvents[eventId.toString()];
this._eventsToRemove.push(item);
item.timeline.removeEvent(item.event);
delete this._scheduledEvents[eventId.toString()];
}
return this;