Commit 34ba3019 authored by Pedro Eduardo Trujillo's avatar Pedro Eduardo Trujillo
Browse files

Marca como pasivas algunas escuchas de eventos

Revisa la asignación de callbacks a eventos, marcando como pasivas
aquellas que pueden serlo (cuando no necesiten llamar al método
preventDefault del evento escuchado). Recomendado por navegadores para
mejorar rendimiento.
parent d7667516
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -98,7 +98,10 @@ define([
			//		private

			globalThis.addEventListener.call(globalThis, 'click', lang.hitch(this, this._evaluateClickEvt));
			globalThis.addEventListener.call(globalThis, 'popstate', lang.hitch(this, this._evaluatePopStateEvt));

			globalThis.addEventListener.call(globalThis, 'popstate', lang.hitch(this, this._evaluatePopStateEvt), {
				passive: true
			});
		},

		_evaluateClickEvt: function(evt) {
+3 −1
Original line number Diff line number Diff line
@@ -455,7 +455,9 @@ define([
				dfd.resolve();
			}), this.animationSafetyTimeout);

			this._moduleOwnNode.firstChild.addEventListener('animationend', this._afterAnimationCallback);
			this._moduleOwnNode.firstChild.addEventListener('animationend', this._afterAnimationCallback, {
				passive: true
			});

			this._addClass(currentAnimationClass);

+7 −5
Original line number Diff line number Diff line
@@ -183,22 +183,24 @@ define([

		_addNodeListeners: function() {

			var listenerOpts = { passive: true };

			if (!this._transitionEndCallback) {
				this._transitionEndCallback = lang.hitch(this, this._onWindowTransitionEnd);
			}

			this._windowContentNode.addEventListener('transitionend', this._transitionEndCallback);
			this._windowNode.parentNode.addEventListener('transitionend', this._transitionEndCallback);
			this._windowContentNode.addEventListener('transitionend', this._transitionEndCallback, listenerOpts);
			this._windowNode.parentNode.addEventListener('transitionend', this._transitionEndCallback, listenerOpts);

			if (this.scrollSensitive) {
				this._windowNode.parentNode.parentNode.addEventListener('scrollend', lang.hitch(this,
					this._onGrandParentScroll));
					this._onGrandParentScroll), listenerOpts);
			}

			if (this.resizable) {
				var startCallback = lang.hitch(this, this._onWindowUserResizeStart);
				this._windowNode.addEventListener('mousedown', startCallback);
				this._windowNode.addEventListener('touchstart', startCallback);
				this._windowNode.addEventListener('mousedown', startCallback, listenerOpts);
				this._windowNode.addEventListener('touchstart', startCallback, listenerOpts);
			}
		},

+3 −1
Original line number Diff line number Diff line
@@ -114,7 +114,9 @@ define([
					this.dialog.set("title", namePDF[namePDF.length - 1]);
				}

				this.objectNode.addEventListener("load", lang.hitch(this, this._observerError));
				this.objectNode.addEventListener("load", lang.hitch(this, this._observerError), {
					passive: true
				});
			} else {
				this._showTemplateDisplayerPdfError();
			}
+1 −1
Original line number Diff line number Diff line
@@ -45,7 +45,7 @@ define([

				put(container.parentNode, icon);
				put('!', container);
			}, markerIcon, animatedContainer));
			}, markerIcon, animatedContainer), { passive: true });
		}
	});
});
Loading