mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Expose hasLaunched() on the application, style-scope will load css-es if app hasLaunched
This commit is contained in:
@@ -4,8 +4,16 @@ require("globals");
|
||||
import { Observable, EventData } from "data/observable";
|
||||
|
||||
const events = new Observable();
|
||||
// First merge all functions from events into application-common so that later appModule.on will be defined.
|
||||
global.moduleMerge(events, exports);
|
||||
let launched = false;
|
||||
function setLaunched() {
|
||||
launched = true;
|
||||
events.off("launch", setLaunched);
|
||||
}
|
||||
events.on("launch", setLaunched);
|
||||
|
||||
export function hasLaunched(): boolean {
|
||||
return launched;
|
||||
}
|
||||
|
||||
export { Observable };
|
||||
|
||||
@@ -34,9 +42,9 @@ export function setResources(res: any) {
|
||||
export let android = undefined;
|
||||
export let ios = undefined;
|
||||
|
||||
export function notify(args: EventData): void {
|
||||
events.notify(args);
|
||||
}
|
||||
export const on: typeof events.on = events.on.bind(events);
|
||||
export const off: typeof events.off = events.off.bind(events);
|
||||
export const notify: typeof events.notify = events.notify.bind(events);
|
||||
|
||||
let app: iOSApplication | AndroidApplication;
|
||||
export function setApplication(instance: iOSApplication | AndroidApplication): void {
|
||||
|
||||
Reference in New Issue
Block a user