@@ -366,6 +366,21 @@ export class iOSApplication extends ApplicationCommon implements IiOSApplication
366366 }
367367 }
368368
369+ public _onLivesync ( context ?: ModuleContext ) : void {
370+ // Handle application root module
371+ const isAppRootModuleChanged = context && context . path && context . path . includes ( this . getMainEntry ( ) . moduleName ) && context . type !== 'style' ;
372+
373+ // Set window content when:
374+ // + Application root module is changed
375+ // + View did not handle the change
376+ // Note:
377+ // The case when neither app root module is changed, nor livesync is handled on View,
378+ // then changes will not apply until navigate forward to the module.
379+ if ( isAppRootModuleChanged || ( this . _rootView && ! this . _rootView . _onLivesync ( context ) ) ) {
380+ this . setWindowContent ( ) ;
381+ }
382+ }
383+
369384 private setWindowContent ( view ?: View ) : void {
370385 if ( this . _rootView ) {
371386 // if we already have a root view, we reset it.
@@ -473,6 +488,14 @@ export class iOSApplication extends ApplicationCommon implements IiOSApplication
473488 return this ;
474489 }
475490}
491+
492+ const iosApp = new iOSApplication ( ) ;
493+
494+ // Attach on global, so it can also be overwritten to implement different logic based on flavor
495+ global . __onLiveSyncCore = function ( context ?: ModuleContext ) {
496+ iosApp . _onLivesync ( context ) ;
497+ } ;
498+
476499export * from './application-common' ;
477- export const Application = new iOSApplication ( ) ;
500+ export const Application = iosApp ;
478501export const AndroidApplication = undefined ;
0 commit comments