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

@ -29,7 +29,8 @@ export class SplitPane {
@Element() private el: HTMLElement;
@State() visible = false;
@Prop({context: 'isServer'}) isServer: boolean;
@Prop({ context: 'isServer'}) isServer: boolean;
@Prop({ context: 'window' }) win: Window;
/**
* If true, the split pane will be hidden. Defaults to `false`.
@ -105,7 +106,7 @@ export class SplitPane {
// Listen on media query
const callback = (q: MediaQueryList) => this.visible = q.matches;
const mediaList = window.matchMedia(mediaQuery);
const mediaList = this.win.matchMedia(mediaQuery);
mediaList.addListener(callback);
this.rmL = () => mediaList.removeListener(callback);
this.visible = mediaList.matches;