diff --git a/packages/core/src/components/loading-controller/loading-controller.tsx b/packages/core/src/components/loading-controller/loading-controller.tsx index bc844bb572..c9b1b33729 100644 --- a/packages/core/src/components/loading-controller/loading-controller.tsx +++ b/packages/core/src/components/loading-controller/loading-controller.tsx @@ -46,7 +46,7 @@ export class LoadingController implements IonicControllerApi { @Listen('body:ionLoadingDidLoad') viewDidLoad(ev: LoadingEvent) { - const loading = ev.loading; + const loading = ev.detail.loading; const loadingResolve = this.loadingResolves[loading.id]; if (loadingResolve) { loadingResolve(loading); @@ -57,13 +57,13 @@ export class LoadingController implements IonicControllerApi { @Listen('body:ionLoadingWillPresent') willPresent(ev: LoadingEvent) { - this.loadings.push(ev.loading); + this.loadings.push(ev.detail.loading); } @Listen('body:ionLoadingWillDismiss, body:ionLoadingDidUnload') willDismiss(ev: LoadingEvent) { - const index = this.loadings.indexOf(ev.loading); + const index = this.loadings.indexOf(ev.detail.loading); if (index > -1) { this.loadings.splice(index, 1); } diff --git a/packages/core/src/components/loading/loading.tsx b/packages/core/src/components/loading/loading.tsx index 2c27d7f46d..b3a5cfc8b9 100644 --- a/packages/core/src/components/loading/loading.tsx +++ b/packages/core/src/components/loading/loading.tsx @@ -57,7 +57,7 @@ export class Loading { if (this.showSpinner === null || this.showSpinner === undefined) { this.showSpinner = !!(this.spinner && this.spinner !== 'hide'); } - this.ionLoadingDidLoad.emit({ loading: this } as LoadingEvent); + this.ionLoadingDidLoad.emit({ loading: this }); } ionViewDidEnter() { @@ -70,7 +70,7 @@ export class Loading { this.durationTimeout = setTimeout(() => this.dismiss(), this.duration); } - this.ionLoadingDidPresent.emit({ loading: this } as LoadingEvent); + this.ionLoadingDidPresent.emit({ loading: this }); } present() { @@ -85,7 +85,7 @@ export class Loading { this.animation = null; } - this.ionLoadingWillPresent.emit({ loading: this } as LoadingEvent); + this.ionLoadingWillPresent.emit({ loading: this }); // get the user's animation fn if one was provided let animationBuilder = this.enterAnimation; @@ -121,7 +121,7 @@ export class Loading { return Ionic.controller('animation').then(Animation => { return new Promise(resolve => { - this.ionLoadingWillDismiss.emit({ loading: this } as LoadingEvent); + this.ionLoadingWillDismiss.emit({ loading: this }); // get the user's animation fn if one was provided let animationBuilder = this.exitAnimation; @@ -137,7 +137,7 @@ export class Loading { this.animation = animationBuilder(Animation, this.el); this.animation.onFinish((a: any) => { a.destroy(); - this.ionLoadingDidDismiss.emit({ loading: this } as LoadingEvent); + this.ionLoadingDidDismiss.emit({ loading: this }); Core.dom.write(() => { this.el.parentNode.removeChild(this.el); @@ -151,7 +151,7 @@ export class Loading { } ionViewDidUnload() { - this.ionLoadingDidUnload.emit({ loading: this }as LoadingEvent); + this.ionLoadingDidUnload.emit({ loading: this }); } render() { @@ -205,6 +205,8 @@ export interface LoadingOptions { } -export interface LoadingEvent { - loading: Loading; -} +export interface LoadingEvent extends Event { + detail: { + loading: Loading; + } +} \ No newline at end of file