Bläddra i källkod

dont do updateSize when no handlers

Adam Shaw 8 år sedan
förälder
incheckning
827e86ee1e
1 ändrade filer med 14 tillägg och 10 borttagningar
  1. 14 10
      src/View.js

+ 14 - 10
src/View.js

@@ -260,20 +260,24 @@ var View = FC.View = InteractiveDateComponent.extend({
 
 
 	onAllDateRender: function() {
-		this.applyScreenState(); // TODO: only call if hasHandlers
-		this.publiclyTrigger('viewRender', {
-			context: this,
-			args: [ this, this.el ]
-		});
+		if (this.hasPublicHandlers('viewRender')) {
+			this.applyScreenState();
+			this.publiclyTrigger('viewRender', {
+				context: this,
+				args: [ this, this.el ]
+			});
+		}
 	},
 
 
 	onBeforeAllDateUnrender: function() {
-		this.applyScreenState(); // TODO: only call if hasHandlers
-		this.publiclyTrigger('viewDestroy', {
-			context: this,
-			args: [ this, this.el ]
-		});
+		if (this.hasPublicHandlers('viewDestroy')) {
+			this.applyScreenState(); // TODO: only call if hasHandlers!
+			this.publiclyTrigger('viewDestroy', {
+				context: this,
+				args: [ this, this.el ]
+			});
+		}
 	},