fix: clean up Application types

This commit is contained in:
shirakaba
2022-11-23 15:57:47 +09:00
parent 890be6c888
commit 933af70d39
6 changed files with 47 additions and 31 deletions

View File

@@ -13,22 +13,45 @@ export interface NativeScriptError extends Error {
}
export interface ApplicationEventData extends EventData {
/**
* UIApplication or undefined, unless otherwise specified. Prefer explicit
* properties where possible.
*/
ios?: any;
/**
* androidx.appcompat.app.AppCompatActivity or undefined, unless otherwise
* specified. Prefer explicit properties where possible.
*/
android?: any;
eventName: string;
/**
* Careful with this messy type. A significant refactor is needed to make it
* strictly extend EventData['object'], which is an Observable. It's used in
* various ways:
* - By font-scale: the Application module, typeof import('.')
* - Within index.android.ts: AndroidApplication
* - Within index.ios.ts: iOSApplication
*/
object: any;
}
export interface LaunchEventData extends ApplicationEventData {
/**
* The value stored into didFinishLaunchingWithOptions notification's
* userInfo under 'UIApplicationLaunchOptionsLocalNotificationKey';
* otherwise, null.
*/
ios: unknown;
root?: View | null;
savedInstanceState?: any /* android.os.Bundle */;
}
export interface OrientationChangedEventData extends ApplicationEventData {
android: any /* globalAndroid.app.Application */;
newValue: 'portrait' | 'landscape' | 'unknown';
}
export interface SystemAppearanceChangedEventData extends ApplicationEventData {
android: any /* globalAndroid.app.Application */;
newValue: 'light' | 'dark';
}
@@ -42,15 +65,14 @@ export interface DiscardedErrorEventData extends ApplicationEventData {
error: NativeScriptError;
}
export interface CssChangedEventData extends EventData {
export interface CssChangedEventData extends ApplicationEventData {
cssFile?: string;
cssText?: string;
}
export interface AndroidActivityEventData {
export interface AndroidActivityEventData extends ApplicationEventData {
activity: any /* androidx.appcompat.app.AppCompatActivity */;
eventName: string;
object: any;
object: any /* AndroidApplication */;
}
export interface AndroidActivityBundleEventData extends AndroidActivityEventData {
@@ -84,6 +106,6 @@ export interface RootViewControllerImpl {
contentController: any;
}
export interface LoadAppCSSEventData extends EventData {
export interface LoadAppCSSEventData extends ApplicationEventData {
cssFile: string;
}