diff --git a/angular/src/directives/proxies.ts b/angular/src/directives/proxies.ts index 62d7f5a709..0018ca73c3 100644 --- a/angular/src/directives/proxies.ts +++ b/angular/src/directives/proxies.ts @@ -747,10 +747,16 @@ export class SkeletonText { export declare interface Slide extends StencilComponents<'IonSlide'> {} @Component({ selector: 'ion-slide', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, template: '' }) export class Slide { + ionSlideChanged: EventEmitter; + + constructor(r: ElementRef) { + const el = r.nativeElement; + proxyOutputs(this, el, ['ionSlideChanged']); + } } export declare interface Slides extends StencilComponents<'IonSlides'> {} -@Component({ selector: 'ion-slides', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, template: '', inputs: ['options', 'pager', 'scrollbar'] }) +@Component({ selector: 'ion-slides', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, template: '', inputs: ['mode', 'options', 'pager', 'scrollbar'] }) export class Slides { ionSlidesDidLoad: EventEmitter; ionSlideTap: EventEmitter; @@ -772,7 +778,7 @@ export class Slides { constructor(r: ElementRef) { const el = r.nativeElement; proxyMethods(this, el, ['update', 'slideTo', 'slideNext', 'slidePrev', 'getActiveIndex', 'getPreviousIndex', 'length', 'isEnd', 'isBeginning', 'startAutoplay', 'stopAutoplay', 'lockSwipeToNext', 'lockSwipeToPrev', 'lockSwipes']); - proxyInputs(this, el, ['options', 'pager', 'scrollbar']); + proxyInputs(this, el, ['mode', 'options', 'pager', 'scrollbar']); proxyOutputs(this, el, ['ionSlidesDidLoad', 'ionSlideTap', 'ionSlideDoubleTap', 'ionSlideWillChange', 'ionSlideDidChange', 'ionSlideNextStart', 'ionSlidePrevStart', 'ionSlideNextEnd', 'ionSlidePrevEnd', 'ionSlideTransitionStart', 'ionSlideTransitionEnd', 'ionSlideDrag', 'ionSlideReachStart', 'ionSlideReachEnd', 'ionSlideTouchStart', 'ionSlideTouchEnd']); } } diff --git a/angular/src/providers/nav-controller.ts b/angular/src/providers/nav-controller.ts index d86d553a87..4b657d1ae6 100644 --- a/angular/src/providers/nav-controller.ts +++ b/angular/src/providers/nav-controller.ts @@ -21,7 +21,7 @@ export class NavController { private location: Location, @Optional() private router?: Router ) { - window && window.document.body.addEventListener('ionBackButton', (ev) => { + window && window.document.addEventListener('ionBackButton', (ev) => { (ev as BackButtonEvent).detail.register(0, () => this.goBack()); }); } diff --git a/core/src/components.d.ts b/core/src/components.d.ts index 367e569fc1..9689908333 100644 --- a/core/src/components.d.ts +++ b/core/src/components.d.ts @@ -4019,7 +4019,7 @@ export namespace Components { * The text to display on the ok button. Default: `OK`. */ 'okText': string; - 'open': (ev?: UIEvent | undefined) => Promise; + 'open': (ev?: UIEvent | undefined) => Promise; /** * The text to display when the select is empty. */ diff --git a/core/src/components/router/router.tsx b/core/src/components/router/router.tsx index 99f06bfbf3..d10970ab7e 100644 --- a/core/src/components/router/router.tsx +++ b/core/src/components/router/router.tsx @@ -81,7 +81,7 @@ export class Router { return this.writeNavStateRoot(path, direction); } - @Listen('window:ionBackButton') + @Listen('document:ionBackButton') protected onBackButton(ev: BackButtonEvent) { ev.detail.register(0, () => this.goBack()); } diff --git a/core/src/utils/hardware-back-button.ts b/core/src/utils/hardware-back-button.ts index f2cfd297f3..49716e57d4 100644 --- a/core/src/utils/hardware-back-button.ts +++ b/core/src/utils/hardware-back-button.ts @@ -9,11 +9,11 @@ interface HandlerRegister { export function startHardwareBackButton(win: Window) { let busy = false; - win.addEventListener('backbutton', () => { + win.document.addEventListener('backbutton', () => { if (busy) { return; } - busy = true; + const handlers: HandlerRegister[] = []; const ev: BackButtonEvent = new CustomEvent('ionBackButton', { bubbles: false, @@ -23,9 +23,10 @@ export function startHardwareBackButton(win: Window) { } } }); - win.document.body.dispatchEvent(ev); + win.document.dispatchEvent(ev); if (handlers.length > 0) { + busy = true; let selectedPriority = Number.MIN_SAFE_INTEGER; let handler: Handler; handlers.forEach(h => { @@ -34,9 +35,15 @@ export function startHardwareBackButton(win: Window) { handler = h.handler; } }); - const result = handler!(); - if (result != null) { - result.then(() => busy = false); + try { + const result = handler!(); + if (result != null) { + result.then(() => (busy = false), () => (busy = false)); + } else { + busy = false; + } + } catch (ev) { + busy = false; } } }); diff --git a/core/src/utils/overlays.ts b/core/src/utils/overlays.ts index f46ff1402b..afd4285e74 100644 --- a/core/src/utils/overlays.ts +++ b/core/src/utils/overlays.ts @@ -19,7 +19,7 @@ export function createOverlay(element: T, opts: // append the overlay element to the document body getAppRoot(doc).appendChild(element); - doc.body.addEventListener('ionBackButton', ev => { + doc.addEventListener('ionBackButton', ev => { (ev as BackButtonEvent).detail.register(100, () => closeTopOverlay(doc)); });