From 8cb726aedf3b2bef280a74e59e352577ce700f3b Mon Sep 17 00:00:00 2001 From: Vasil Chimev Date: Tue, 22 Jan 2019 14:37:29 +0200 Subject: [PATCH] fix-next: avoid circular reference (#6812) --- tns-core-modules/application/application-common.ts | 7 +++---- tns-core-modules/application/application.android.ts | 3 ++- tns-core-modules/application/application.ios.ts | 7 ++++--- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/tns-core-modules/application/application-common.ts b/tns-core-modules/application/application-common.ts index 166c4e0d1..0114d4239 100644 --- a/tns-core-modules/application/application-common.ts +++ b/tns-core-modules/application/application-common.ts @@ -2,6 +2,7 @@ require("globals"); import { Observable, EventData } from "../data/observable"; +import { View } from "../ui/core/view"; import { trace as profilingTrace, time, @@ -35,7 +36,6 @@ export { Observable }; import { AndroidApplication, CssChangedEventData, - getRootView, iOSApplication, LoadAppCSSEventData, UnhandledErrorEventData, @@ -79,10 +79,10 @@ export function setApplication(instance: iOSApplication | AndroidApplication): v app = instance; } -export function livesync(context?: HmrContext) { +export function livesync(rootView: View, context?: HmrContext) { events.notify({ eventName: "livesync", object: app }); const liveSyncCore = global.__onLiveSyncCore; - let reapplyAppCss = false + let reapplyAppCss = false; if (context) { const fullFileName = getCssFileName(); @@ -91,7 +91,6 @@ export function livesync(context?: HmrContext) { reapplyAppCss = extensions.some(ext => context.module === fileName.concat(ext)); } - const rootView = getRootView(); if (reapplyAppCss && rootView) { rootView._onCssStateChange(); } else if (liveSyncCore) { diff --git a/tns-core-modules/application/application.android.ts b/tns-core-modules/application/application.android.ts index e27378534..3b4221dd5 100644 --- a/tns-core-modules/application/application.android.ts +++ b/tns-core-modules/application/application.android.ts @@ -217,7 +217,8 @@ global.__onLiveSync = function __onLiveSync(context?: HmrContext) { return; } - livesync(context); + const rootView = getRootView(); + livesync(rootView, context); }; function initLifecycleCallbacks() { diff --git a/tns-core-modules/application/application.ios.ts b/tns-core-modules/application/application.ios.ts index b69af024b..f875717db 100644 --- a/tns-core-modules/application/application.ios.ts +++ b/tns-core-modules/application/application.ios.ts @@ -21,7 +21,7 @@ import { Frame, NavigationEntry } from "../ui/frame"; import * as utils from "../utils/utils"; import { profile, level as profilingLevel, Level } from "../profiling"; -// NOTE: UIResponder with implementation of window - related to https://github.com/NativeScript/ios-runtime/issues/430 +// NOTE: UIResponder with implementation of window - related to https://github.com/NativeScript/ios-runtime/issues/430 // TODO: Refactor the UIResponder to use Typescript extends when this issue is resolved: // https://github.com/NativeScript/ios-runtime/issues/1012 var Responder = (UIResponder).extend({ @@ -161,7 +161,7 @@ class IOSApplication implements IOSApplicationDefinition { this.setWindowContent(args.root); } else { this._window = UIApplication.sharedApplication.delegate.window; - } + } } @profile @@ -378,5 +378,6 @@ global.__onLiveSync = function __onLiveSync(context?: HmrContext) { return; } - livesync(context); + const rootView = getRootView(); + livesync(rootView, context); } \ No newline at end of file