Expose hasLaunched() on the application, style-scope will load css-es if app hasLaunched

This commit is contained in:
Panayot Cankov
2017-03-13 09:49:41 +02:00
parent 6a0f12b677
commit d38e99cabd
3 changed files with 33 additions and 6 deletions

View File

@@ -74,7 +74,16 @@ function loadCss(cssFile?: string): RuleSet[] {
application.on("cssChanged", onCssChanged);
application.on("livesync", onLiveSync);
application.on("launch", () => loadCss(application.getCssFileName()));
function loadCssOnLaunch() {
loadCss(application.getCssFileName());
application.off("launch", loadCssOnLaunch);
}
if (application.hasLaunched()) {
loadCssOnLaunch();
} else {
application.on("launch", loadCssOnLaunch);
}
let pattern: RegExp = /('|")(.*?)\1/;