@@ -4,7 +4,6 @@ import '../globals';
44// Types
55import { AndroidApplication , iOSApplication } from '.' ;
66import { CssChangedEventData , DiscardedErrorEventData , LoadAppCSSEventData , UnhandledErrorEventData } from './application-interfaces' ;
7- import { EventData } from '../data/observable' ;
87import { View } from '../ui/core/view' ;
98
109// Requires
@@ -50,10 +49,10 @@ export function setResources(res: any) {
5049export const android : AndroidApplication = undefined ;
5150export const ios : iOSApplication = undefined ;
5251
53- export const on = global . NativeScriptGlobals . events . on . bind ( global . NativeScriptGlobals . events ) ;
54- export const off = global . NativeScriptGlobals . events . off . bind ( global . NativeScriptGlobals . events ) ;
55- export const notify = global . NativeScriptGlobals . events . notify . bind ( global . NativeScriptGlobals . events ) ;
56- export const hasListeners = global . NativeScriptGlobals . events . hasListeners . bind ( global . NativeScriptGlobals . events ) ;
52+ export const on = global . NativeScriptGlobals . events . on . bind ( global . NativeScriptGlobals . events ) as typeof import ( '.' ) [ 'on' ] ;
53+ export const off = global . NativeScriptGlobals . events . off . bind ( global . NativeScriptGlobals . events ) as typeof import ( '.' ) [ 'off' ] ;
54+ export const notify = global . NativeScriptGlobals . events . notify . bind ( global . NativeScriptGlobals . events ) as typeof import ( '.' ) [ 'notify' ] ;
55+ export const hasListeners = global . NativeScriptGlobals . events . hasListeners . bind ( global . NativeScriptGlobals . events ) as typeof import ( '.' ) [ 'hasListeners' ] ;
5756
5857let app : iOSApplication | AndroidApplication ;
5958export function setApplication ( instance : iOSApplication | AndroidApplication ) : void {
@@ -63,7 +62,7 @@ export function setApplication(instance: iOSApplication | AndroidApplication): v
6362}
6463
6564export function livesync ( rootView : View , context ?: ModuleContext ) {
66- global . NativeScriptGlobals . events . notify ( < EventData > { eventName : 'livesync' , object : app } ) ;
65+ notify ( { eventName : 'livesync' , object : app } ) ;
6766 const liveSyncCore = global . __onLiveSyncCore ;
6867 let reapplyAppStyles = false ;
6968
@@ -85,7 +84,7 @@ export function livesync(rootView: View, context?: ModuleContext) {
8584
8685export function setCssFileName ( cssFileName : string ) {
8786 cssFile = cssFileName ;
88- global . NativeScriptGlobals . events . notify ( < CssChangedEventData > {
87+ notify ( < CssChangedEventData > {
8988 eventName : 'cssChanged' ,
9089 object : app ,
9190 cssFile : cssFileName ,
@@ -98,7 +97,7 @@ export function getCssFileName(): string {
9897
9998export function loadAppCss ( ) : void {
10099 try {
101- global . NativeScriptGlobals . events . notify ( < LoadAppCSSEventData > {
100+ notify ( < LoadAppCSSEventData > {
102101 eventName : 'loadAppCss' ,
103102 object : app ,
104103 cssFile : getCssFileName ( ) ,
@@ -181,7 +180,7 @@ export function setSuspended(value: boolean): void {
181180}
182181
183182global . __onUncaughtError = function ( error : NativeScriptError ) {
184- global . NativeScriptGlobals . events . notify ( < UnhandledErrorEventData > {
183+ notify ( < UnhandledErrorEventData > {
185184 eventName : uncaughtErrorEvent ,
186185 object : app ,
187186 android : error ,
@@ -191,7 +190,7 @@ global.__onUncaughtError = function (error: NativeScriptError) {
191190} ;
192191
193192global . __onDiscardedError = function ( error : NativeScriptError ) {
194- global . NativeScriptGlobals . events . notify ( < DiscardedErrorEventData > {
193+ notify ( < DiscardedErrorEventData > {
195194 eventName : discardedErrorEvent ,
196195 object : app ,
197196 error : error ,
0 commit comments