Explorar o código

EventSource::removeAllEventDefs

Adam Shaw %!s(int64=8) %!d(string=hai) anos
pai
achega
82aeddf407

+ 11 - 0
src/models/EventManager.js

@@ -228,6 +228,17 @@ var EventManager = Class.extend(EmitterMixin, ListenerMixin, {
 	},
 
 
+	removeAllEventDefs: function() {
+		this.getSources().forEach(function(eventSource) {
+			eventSource.removeAllEventDefs();
+		});
+
+		if (this.currentPeriod) {
+			this.currentPeriod.removeAllEventDefs();
+		}
+	},
+
+
 	// Event Mutating
 	// -----------------------------------------------------------------------------------------------------------------
 

+ 5 - 0
src/models/event-source/ArrayEventSource.js

@@ -54,6 +54,11 @@ var ArrayEventSource = EventSource.extend({
 	},
 
 
+	removeAllEventDefs: function() {
+		this.eventDefs = [];
+	},
+
+
 	getPrimitive: function() {
 		return this.rawEventDefs;
 	},

+ 5 - 0
src/models/event-source/EventSource.js

@@ -37,6 +37,11 @@ var EventSource = Class.extend(ParsableModelMixin, {
 	},
 
 
+	removeAllEventDefs: function() {
+		// optional for subclasses to implement
+	},
+
+
 	/*
 	For compairing/matching
 	*/