mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
fix: global types
This commit is contained in:
@@ -4,7 +4,7 @@ import '../globals';
|
|||||||
// Types
|
// Types
|
||||||
import { AndroidApplication, iOSApplication } from '.';
|
import { AndroidApplication, iOSApplication } from '.';
|
||||||
import { CssChangedEventData, DiscardedErrorEventData, LoadAppCSSEventData, UnhandledErrorEventData } from './application-interfaces';
|
import { CssChangedEventData, DiscardedErrorEventData, LoadAppCSSEventData, UnhandledErrorEventData } from './application-interfaces';
|
||||||
import { EventData } from '../data/observable';
|
import type { EventData, Observable } from '../data/observable';
|
||||||
import { View } from '../ui/core/view';
|
import { View } from '../ui/core/view';
|
||||||
|
|
||||||
// Requires
|
// Requires
|
||||||
@@ -50,10 +50,10 @@ export function setResources(res: any) {
|
|||||||
export const android: AndroidApplication = undefined;
|
export const android: AndroidApplication = undefined;
|
||||||
export const ios: iOSApplication = undefined;
|
export const ios: iOSApplication = undefined;
|
||||||
|
|
||||||
export const on = global.NativeScriptGlobals.events.on.bind(global.NativeScriptGlobals.events);
|
export const on = global.NativeScriptGlobals.events.on.bind(global.NativeScriptGlobals.events) as Observable['on'];
|
||||||
export const off = global.NativeScriptGlobals.events.off.bind(global.NativeScriptGlobals.events);
|
export const off = global.NativeScriptGlobals.events.off.bind(global.NativeScriptGlobals.events) as Observable['off'];
|
||||||
export const notify = global.NativeScriptGlobals.events.notify.bind(global.NativeScriptGlobals.events);
|
export const notify = global.NativeScriptGlobals.events.notify.bind(global.NativeScriptGlobals.events) as Observable['notify'];
|
||||||
export const hasListeners = global.NativeScriptGlobals.events.hasListeners.bind(global.NativeScriptGlobals.events);
|
export const hasListeners = global.NativeScriptGlobals.events.hasListeners.bind(global.NativeScriptGlobals.events) as Observable['hasListeners'];
|
||||||
|
|
||||||
let app: iOSApplication | AndroidApplication;
|
let app: iOSApplication | AndroidApplication;
|
||||||
export function setApplication(instance: iOSApplication | AndroidApplication): void {
|
export function setApplication(instance: iOSApplication | AndroidApplication): void {
|
||||||
|
|||||||
12
packages/core/global-types.d.ts
vendored
12
packages/core/global-types.d.ts
vendored
@@ -25,17 +25,7 @@ declare namespace NodeJS {
|
|||||||
* Global framework event handling
|
* Global framework event handling
|
||||||
*/
|
*/
|
||||||
events: {
|
events: {
|
||||||
on(eventNames: string, callback: (data: any) => void, thisArg?: any);
|
[Key in keyof import('data/observable').Observable]: import('data/observable').Observable[Key];
|
||||||
on(event: 'propertyChange', callback: (data: any) => void, thisArg?: any);
|
|
||||||
off(eventNames: string, callback?: any, thisArg?: any);
|
|
||||||
addEventListener(eventNames: string, callback: (data: any) => void, thisArg?: any);
|
|
||||||
removeEventListener(eventNames: string, callback?: any, thisArg?: any);
|
|
||||||
set(name: string, value: any): void;
|
|
||||||
setProperty(name: string, value: any): void;
|
|
||||||
get(name: string): any;
|
|
||||||
notify<T>(data: any): void;
|
|
||||||
notifyPropertyChange(propertyName: string, value: any, oldValue?: any): void;
|
|
||||||
hasListeners(eventName: string): boolean;
|
|
||||||
};
|
};
|
||||||
launched: boolean;
|
launched: boolean;
|
||||||
// used by various classes to setup callbacks to wire up global app event handling when the app instance is ready
|
// used by various classes to setup callbacks to wire up global app event handling when the app instance is ready
|
||||||
|
|||||||
Reference in New Issue
Block a user