File tree Expand file tree Collapse file tree
packages/core/application Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -159,14 +159,18 @@ export interface AndroidApplication {
159159 on ( event : 'activityRequestPermissions' , callback : ( args : AndroidActivityRequestPermissionsEventData ) => void , thisArg ?: any ) ;
160160}
161161
162- const androidApp = new AndroidApplication ( ) ;
162+ let androidApp : AndroidApplication ;
163163export { androidApp as android } ;
164- appCommon . setApplication ( androidApp ) ;
165164
166165let mainEntry : NavigationEntry ;
167166let started = false ;
168167
169168export function run ( entry ?: NavigationEntry | string ) {
169+ if ( ! androidApp ) {
170+ androidApp = new AndroidApplication ( ) ;
171+ appCommon . setApplication ( androidApp ) ;
172+ }
173+
170174 if ( started ) {
171175 throw new Error ( 'Application is already started.' ) ;
172176 }
Original file line number Diff line number Diff line change @@ -349,10 +349,9 @@ export class iOSApplication implements iOSApplicationDefinition {
349349}
350350
351351/* tslint:disable */
352- const iosApp = new iOSApplication ( ) ;
352+ let iosApp : iOSApplication ;
353353/* tslint:enable */
354354export { iosApp as ios } ;
355- setApplication ( iosApp ) ;
356355
357356// attach on global, so it can be overwritten in NativeScript Angular
358357( < any > global ) . __onLiveSyncCore = function ( context ?: ModuleContext ) {
@@ -389,6 +388,11 @@ export function getRootView() {
389388
390389let started = false ;
391390export function run ( entry ?: string | NavigationEntry ) {
391+ if ( ! iosApp ) {
392+ iosApp = new iOSApplication ( ) ;
393+ setApplication ( iosApp ) ;
394+ }
395+
392396 mainEntry = typeof entry === 'string' ? { moduleName : entry } : entry ;
393397 started = true ;
394398
You can’t perform that action at this time.
0 commit comments