From 8a5778661bee3bb0f781f1d41eb8cbd3597a69e1 Mon Sep 17 00:00:00 2001 From: Adam Bradley Date: Thu, 15 Oct 2015 10:29:20 -0500 Subject: [PATCH] chore(): zone.runOutsideAngular --- ionic/components/nav/nav.ts | 11 ++++++++--- ionic/components/slides/swiper-widget.ts | 3 ++- ionic/components/tap-click/activator.ts | 2 +- ionic/gestures/hammer.ts | 3 +++ ionic/util/keyboard.ts | 14 ++++++++------ 5 files changed, 22 insertions(+), 11 deletions(-) diff --git a/ionic/components/nav/nav.ts b/ionic/components/nav/nav.ts index 9320cf1c4b..781f18cb5e 100644 --- a/ionic/components/nav/nav.ts +++ b/ionic/components/nav/nav.ts @@ -130,9 +130,6 @@ import {NavController} from './nav-controller'; defaultInputs: { 'swipeBackEnabled': true }, - host: { - '[class.has-views]': '_views.length > 0' - }, template: '', directives: [forwardRef(() => NavPaneAnchor)] }) @@ -256,6 +253,14 @@ export class Nav extends NavController { }); } + if (this._views.length === 1) { + this._zone.runOutsideAngular(() => { + // setTimeout(function() { + // componentRef && componentRef.location && componentRef.location.nativeElement.classList.add('has-views'); + // }, 100); + }); + } + done(); }); diff --git a/ionic/components/slides/swiper-widget.ts b/ionic/components/slides/swiper-widget.ts index 00b6b4c1ed..85c00f92e2 100644 --- a/ionic/components/slides/swiper-widget.ts +++ b/ionic/components/slides/swiper-widget.ts @@ -19,7 +19,7 @@ ===========================*/ export function Swiper(container, params) { - + if (!(this instanceof Swiper)) return new Swiper(container, params); var defaults = { @@ -987,6 +987,7 @@ export function Swiper(container, params) { // Attach/detach events s.initEvents = function (detach) { + console.debug('swiper initEvents', detach ? 'detach' : 'attach'); var actionDom = detach ? 'off' : 'on'; var action = detach ? 'removeEventListener' : 'addEventListener'; var touchEventsTarget = s.params.touchEventsTarget === 'container' ? s.container[0] : s.wrapper[0]; diff --git a/ionic/components/tap-click/activator.ts b/ionic/components/tap-click/activator.ts index 7adcc819f8..928199f796 100644 --- a/ionic/components/tap-click/activator.ts +++ b/ionic/components/tap-click/activator.ts @@ -49,7 +49,7 @@ export class Activator { clearState() { // all states should return to normal - if ((!this.app.isEnabled() || this.app.isTransitioning()) && this.clearAttempt < 30) { + if ((!this.app.isEnabled() || this.app.isTransitioning()) && this.clearAttempt < 100) { // the app is actively disabled, so don't bother deactivating anything. // this makes it easier on the GPU so it doesn't have to redraw any // buttons during a transition. This will retry in XX milliseconds. diff --git a/ionic/gestures/hammer.ts b/ionic/gestures/hammer.ts index 556389460b..c9e769ff73 100644 --- a/ionic/gestures/hammer.ts +++ b/ionic/gestures/hammer.ts @@ -165,6 +165,7 @@ function ifUndefined(val1, val2) { */ function addEventListeners(target, types, handler) { each(splitStr(types), function(type) { + console.debug('hammer addEventListener', type, target.tagName); target.addEventListener(type, handler, false); }); } @@ -177,6 +178,7 @@ function addEventListeners(target, types, handler) { */ function removeEventListeners(target, types, handler) { each(splitStr(types), function(type) { + console.debug('hammer removeEventListener', type, target.tagName); target.removeEventListener(type, handler, false); }); } @@ -392,6 +394,7 @@ Input.prototype = { * bind the events */ init: function() { + console.debug('hammer Input init') this.evEl && addEventListeners(this.element, this.evEl, this.domHandler); this.evTarget && addEventListeners(this.target, this.evTarget, this.domHandler); this.evWin && addEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler); diff --git a/ionic/util/keyboard.ts b/ionic/util/keyboard.ts index e6ad663767..ff9618c8ce 100644 --- a/ionic/util/keyboard.ts +++ b/ionic/util/keyboard.ts @@ -107,13 +107,15 @@ export class IonicKeyboard { function enableKeyInput() { cssClass(); - document.removeEventListener('mousedown', pointerDown); - document.removeEventListener('touchstart', pointerDown); + this.zone.runOutsideAngular(() => { + document.removeEventListener('mousedown', pointerDown); + document.removeEventListener('touchstart', pointerDown); - if (isKeyInputEnabled) { - document.addEventListener('mousedown', pointerDown); - document.addEventListener('touchstart', pointerDown); - } + if (isKeyInputEnabled) { + document.addEventListener('mousedown', pointerDown); + document.addEventListener('touchstart', pointerDown); + } + }); } document.addEventListener('keydown', keyDown);