From 7e9752b9a0f1e2d30f7669929baf1201e726999e Mon Sep 17 00:00:00 2001 From: Igor Randjelovic Date: Fri, 12 May 2023 19:10:17 +0200 Subject: [PATCH] chore: cleanup --- .../core/application/application-common.ts | 22 +++++++++++++------ .../application/application-interfaces.ts | 1 - packages/core/application/application.ios.ts | 6 +---- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/packages/core/application/application-common.ts b/packages/core/application/application-common.ts index c271495b7..e9942fd58 100644 --- a/packages/core/application/application-common.ts +++ b/packages/core/application/application-common.ts @@ -19,13 +19,11 @@ import { ApplicationEventData, CssChangedEventData, DiscardedErrorEventData, - FontScaleChangedEventData, LaunchEventData, LoadAppCSSEventData, NativeScriptError, OrientationChangedEventData, SystemAppearanceChangedEventData, - UnhandledErrorEventData, } from './application-interfaces'; const ORIENTATION_CSS_CLASSES = [ @@ -68,6 +66,8 @@ export class ApplicationCommon { readonly systemAppearanceChangedEvent = 'systemAppearanceChanged'; readonly fontScaleChangedEvent = 'fontScaleChanged'; readonly livesyncEvent = 'livesync'; + readonly loadAppCssEvent = 'loadAppCss'; + readonly cssChangedEvent = 'cssChanged'; // Application events go through the global events. readonly on: ApplicationEvents['on'] = globalEvents.on.bind(globalEvents); @@ -107,6 +107,9 @@ export class ApplicationCommon { }; } + /** + * @internal + */ livesync(rootView: View, context?: ModuleContext) { this.notify({ eventName: this.livesyncEvent, object: this }); const liveSyncCore = global.__onLiveSyncCore; @@ -228,7 +231,11 @@ export class ApplicationCommon { // implement in platform specific files (iOS only for now) } - mainEntry: NavigationEntry; + protected mainEntry: NavigationEntry; + + /** + * @returns The main entry of the application + */ getMainEntry() { return this.mainEntry; } @@ -248,6 +255,7 @@ export class ApplicationCommon { return launchArgs.root; } + @profile createRootView(view?: View, fireLaunchEvent = false, additionalLanchEventData?: any) { let rootView = view; @@ -305,14 +313,14 @@ export class ApplicationCommon { bindableResources.set(res); } - cssFile = './app.css'; + private cssFile = './app.css'; /** * Sets css file name for the application. */ setCssFileName(cssFileName: string) { this.cssFile = cssFileName; this.notify({ - eventName: 'cssChanged', + eventName: this.cssChangedEvent, object: this, cssFile: cssFileName, }); @@ -334,7 +342,7 @@ export class ApplicationCommon { loadAppCss(): void { try { this.notify({ - eventName: 'loadAppCss', + eventName: this.loadAppCssEvent, object: this, ios: this.ios, android: this.android, @@ -353,7 +361,7 @@ export class ApplicationCommon { addCss(cssText: string, attributeScoped?: boolean): void { this.notify({ - eventName: 'cssChanged', + eventName: this.cssChangedEvent, object: this, cssText: cssText, }); diff --git a/packages/core/application/application-interfaces.ts b/packages/core/application/application-interfaces.ts index 861aa9066..e9e404ab3 100644 --- a/packages/core/application/application-interfaces.ts +++ b/packages/core/application/application-interfaces.ts @@ -1,4 +1,3 @@ -// Types import type { ApplicationCommon } from '.'; import type { EventData, Observable } from '../data/observable'; import type { View } from '../ui/core/view'; diff --git a/packages/core/application/application.ios.ts b/packages/core/application/application.ios.ts index 3de967205..dc1a3d934 100644 --- a/packages/core/application/application.ios.ts +++ b/packages/core/application/application.ios.ts @@ -5,11 +5,7 @@ import { NavigationEntry } from '../ui/frame/frame-interfaces'; import * as Utils from '../utils'; import type { iOSApplication as IiOSApplication } from './application'; import { ApplicationCommon } from './application-common'; -import { - ApplicationEventData, - LaunchEventData, - LoadAppCSSEventData, -} from './application-interfaces'; +import { ApplicationEventData } from './application-interfaces'; @NativeClass class CADisplayLinkTarget extends NSObject {