Просмотр исходного кода

bindGlobalHandlers to ChronoComponent

Adam Shaw 8 лет назад
Родитель
Сommit
9378eeceee
2 измененных файлов с 10 добавлено и 2 удалено
  1. 10 0
      src/common/ChronoComponent.js
  2. 0 2
      src/common/View.js

+ 10 - 0
src/common/ChronoComponent.js

@@ -48,6 +48,7 @@ var ChronoComponent = Model.extend({
 	// and renders all the non-date-related content inside.
 	setElement: function(el) {
 		this.el = el;
+		this.bindGlobalHandlers();
 		this.renderSkeleton();
 	},
 
@@ -57,6 +58,7 @@ var ChronoComponent = Model.extend({
 	removeElement: function() {
 		this.unsetDate();
 		this.unrenderSkeleton();
+		this.unbindGlobalHandlers();
 
 		this.el.remove();
 		// NOTE: don't null-out this.el in case the View was destroyed within an API callback.
@@ -65,6 +67,14 @@ var ChronoComponent = Model.extend({
 	},
 
 
+	bindGlobalHandlers: function() {
+	},
+
+
+	unbindGlobalHandlers: function() {
+	},
+
+
 	// Skeleton
 	// -----------------------------------------------------------------------------------------------------------------
 

+ 0 - 2
src/common/View.js

@@ -199,13 +199,11 @@ var View = FC.View = ChronoComponent.extend({
 	setElement: function(el) {
 		ChronoComponent.prototype.setElement.apply(this, arguments);
 
-		this.bindGlobalHandlers();
 		this.bindBaseRenderHandlers();
 	},
 
 
 	removeElement: function() {
-		this.unbindGlobalHandlers();
 		this.unbindBaseRenderHandlers();
 
 		ChronoComponent.prototype.removeElement.apply(this, arguments);