fix(prerender): local references to window/document

This commit is contained in:
Manu Mtz.-Almeida
2018-04-19 13:26:49 +02:00
parent 86a6cde4a1
commit 78bd146ad2
42 changed files with 174 additions and 139 deletions

View File

@ -1,4 +1,4 @@
import { Component, Listen, Method } from '@stencil/core';
import { Component, Listen, Method, Prop } from '@stencil/core';
import { AlertOptions } from '../../index';
import { OverlayController, createOverlay, dismissOverlay, getTopOverlay, removeLastOverlay } from '../../utils/overlays';
@ -9,6 +9,8 @@ export class AlertController implements OverlayController {
private alerts = new Map<number, HTMLIonAlertElement>();
@Prop({ context: 'document' }) doc: Document;
@Listen('body:ionAlertWillPresent')
protected alertWillPresent(ev: any) {
this.alerts.set(ev.target.overlayId, ev.target);
@ -30,7 +32,7 @@ export class AlertController implements OverlayController {
*/
@Method()
create(opts?: AlertOptions): Promise<HTMLIonAlertElement> {
return createOverlay(document.createElement('ion-alert'), opts);
return createOverlay(this.doc.createElement('ion-alert'), opts);
}
/*