Jelajahi Sumber

methodize some biz hour tasks

Adam Shaw 8 tahun lalu
induk
melakukan
c0d6c471a1
1 mengubah file dengan 16 tambahan dan 10 penghapusan
  1. 16 10
      src/component/DateComponent.js

+ 16 - 10
src/component/DateComponent.js

@@ -55,6 +55,8 @@ var DateComponent = FC.DateComponent = Component.extend({
 
 
 	defineLateWatchers: function() {
+		this.defineDisplayingBusinessHours();
+		this.defineBusinessHourGeneratorInChildren();
 		this.defineDisplayingEvents();
 		this.defineEventDataSourceInChildren();
 	},
@@ -809,18 +811,22 @@ DateComponent.watch('businessHours', [ 'businessHourGenerator', 'dateProfile' ],
 });
 
 
-DateComponent.watch('displayingBusinessHours', [ 'displayingDates', 'businessHours' ], function(deps) {
-	this.requestRender(this.renderBusinessHours, [ deps.businessHours ], 'businessHours', 'init');
-}, function() {
-	this.requestRender(this.unrenderBusinessHours, null, 'businessHours', 'destroy');
-});
+DateComponent.prototype.defineDisplayingBusinessHours = function() {
+	this.watch('displayingBusinessHours', [ 'displayingDates', 'businessHours' ], function(deps) {
+		this.requestRender(this.renderBusinessHours, [ deps.businessHours ], 'businessHours', 'init');
+	}, function() {
+		this.requestRender(this.unrenderBusinessHours, null, 'businessHours', 'destroy');
+	});
+};
 
 
-DateComponent.watch('businessHourGeneratorInChildren', [ 'businessHourGenerator' ], function(deps) {
-	this.setBusinessHourGeneratorInChildren(deps.businessHourGenerator);
-}, function() {
-	this.unsetBusinessHourGeneratorInChildren();
-});
+DateComponent.prototype.defineBusinessHourGeneratorInChildren = function() {
+	this.watch('businessHourGeneratorInChildren', [ 'businessHourGenerator' ], function(deps) {
+		this.setBusinessHourGeneratorInChildren(deps.businessHourGenerator);
+	}, function() {
+		this.unsetBusinessHourGeneratorInChildren();
+	});
+};
 
 
 // wrapped in a function so subclasses can more easily override, considering the necessary ordering