perf(platform): remove from critical path

This commit is contained in:
Manu Mtz.-Almeida
2018-04-18 23:06:56 +02:00
parent 861ce49363
commit 86a6cde4a1
23 changed files with 347 additions and 1001 deletions

View File

@ -1,9 +1,8 @@
import { Component, Element, Listen, Prop, State } from '@stencil/core';
import { Config, PlatformConfig } from '../../index';
import { Config } from '../../index';
import {
DisplayWhen,
updateTestResults,
DisplayWhen, PLATFORM_CONFIGS, PlatformConfig, detectPlatforms, updateTestResults,
} from '../../utils/show-hide-when-utils';
@Component({
@ -12,22 +11,29 @@ import {
})
export class HideWhen implements DisplayWhen {
calculatedPlatforms: PlatformConfig[];
@Element() element: HTMLElement;
@Prop({ context: 'config' }) config: Config;
@Prop({ context: 'platforms' }) calculatedPlatforms: PlatformConfig[];
@Prop({ context: 'window'}) win: Window;
@Prop() orientation: string|undefined;
@Prop() mediaQuery: string|undefined;
@Prop() size: string|undefined;
@Prop() mode: string|undefined;
@Prop() platform: string|undefined;
@Prop() orientation: string;
@Prop() mediaQuery: string;
@Prop() size: string;
@Prop() mode: string;
@Prop() platform: string;
@Prop() or = false;
@State() passesTest = false;
@Listen('window:resize')
componentWillLoad() {
return updateTestResults(this);
this.calculatedPlatforms = detectPlatforms(this.win, PLATFORM_CONFIGS);
this.onResize();
}
@Listen('window:resize')
onResize() {
updateTestResults(this);
}
hostData() {