Ver código fonte

SingleEventDef::buildInstance

Adam Shaw 8 anos atrás
pai
commit
1480184b65

+ 1 - 1
src/Calendar.events-api.js

@@ -166,7 +166,7 @@ Calendar.mixin({
 		var eventDefMutation;
 
 		if (eventDef instanceof SingleEventDef) {
-			eventInstance = eventDef.buildInstances()[0];
+			eventInstance = eventDef.buildInstance();
 
 			eventDefMutation = EventDefMutation.createFromRawProps(
 				eventInstance,

+ 1 - 1
src/common/Grid.js

@@ -477,7 +477,7 @@ var Grid = FC.Grid = ChronoComponent.extend({
 		var dummyInstance;
 
 		dummyEvent.dateProfile = eventDateProfile;
-		dummyInstance = dummyEvent.buildInstances()[0];
+		dummyInstance = dummyEvent.buildInstance();
 
 		return new EventFootprint(componentFootprint, dummyEvent, dummyInstance);
 	},

+ 1 - 1
src/common/View.js

@@ -772,7 +772,7 @@ var View = FC.View = ChronoComponent.extend({
 			this.publiclyTrigger(
 				'eventReceive',
 				null,
-				singleEventDef.buildInstances()[0].toLegacy()
+				singleEventDef.buildInstance().toLegacy()
 			);
 		}
 	},

+ 9 - 6
src/models/event/SingleEventDef.js

@@ -8,12 +8,15 @@ var SingleEventDef = EventDef.extend({
 	Will receive start/end params, but will be ignored.
 	*/
 	buildInstances: function() {
-		return [
-			new EventInstance(
-				this, // definition
-				this.dateProfile
-			)
-		];
+		return [ this.buildInstance() ];
+	},
+
+
+	buildInstance: function() {
+		return new EventInstance(
+			this, // definition
+			this.dateProfile
+		);
 	},