mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-02-04 05:07:59 +08:00
chore(): zone.runOutsideAngular
This commit is contained in:
@@ -130,9 +130,6 @@ import {NavController} from './nav-controller';
|
||||
defaultInputs: {
|
||||
'swipeBackEnabled': true
|
||||
},
|
||||
host: {
|
||||
'[class.has-views]': '_views.length > 0'
|
||||
},
|
||||
template: '<template pane-anchor></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();
|
||||
});
|
||||
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user