mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-17 10:41:13 +08:00
fix(prerender): local references to window/document
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
import { Component, Listen, Method } from '@stencil/core';
|
||||
import { Component, Listen, Method, Prop } from '@stencil/core';
|
||||
import { LoadingOptions } from '../../index';
|
||||
import { OverlayController, createOverlay, dismissOverlay, getTopOverlay, removeLastOverlay } from '../../utils/overlays';
|
||||
|
||||
@ -10,6 +10,8 @@ export class LoadingController implements OverlayController {
|
||||
|
||||
private loadings = new Map<number, HTMLIonLoadingElement>();
|
||||
|
||||
@Prop({ context: 'document' }) doc: Document;
|
||||
|
||||
@Listen('body:ionLoadingWillPresent')
|
||||
protected loadingWillPresent(ev: any) {
|
||||
this.loadings.set(ev.target.overlayId, ev.target);
|
||||
@ -31,7 +33,7 @@ export class LoadingController implements OverlayController {
|
||||
*/
|
||||
@Method()
|
||||
create(opts?: LoadingOptions): Promise<HTMLIonLoadingElement> {
|
||||
return createOverlay(document.createElement('ion-loading'), opts);
|
||||
return createOverlay(this.doc.createElement('ion-loading'), opts);
|
||||
}
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user