mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
fix-next: avoid circular reference (#6812)
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
require("globals");
|
require("globals");
|
||||||
|
|
||||||
import { Observable, EventData } from "../data/observable";
|
import { Observable, EventData } from "../data/observable";
|
||||||
|
import { View } from "../ui/core/view";
|
||||||
import {
|
import {
|
||||||
trace as profilingTrace,
|
trace as profilingTrace,
|
||||||
time,
|
time,
|
||||||
@@ -35,7 +36,6 @@ export { Observable };
|
|||||||
import {
|
import {
|
||||||
AndroidApplication,
|
AndroidApplication,
|
||||||
CssChangedEventData,
|
CssChangedEventData,
|
||||||
getRootView,
|
|
||||||
iOSApplication,
|
iOSApplication,
|
||||||
LoadAppCSSEventData,
|
LoadAppCSSEventData,
|
||||||
UnhandledErrorEventData,
|
UnhandledErrorEventData,
|
||||||
@@ -79,10 +79,10 @@ export function setApplication(instance: iOSApplication | AndroidApplication): v
|
|||||||
app = instance;
|
app = instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function livesync(context?: HmrContext) {
|
export function livesync(rootView: View, context?: HmrContext) {
|
||||||
events.notify(<EventData>{ eventName: "livesync", object: app });
|
events.notify(<EventData>{ eventName: "livesync", object: app });
|
||||||
const liveSyncCore = global.__onLiveSyncCore;
|
const liveSyncCore = global.__onLiveSyncCore;
|
||||||
let reapplyAppCss = false
|
let reapplyAppCss = false;
|
||||||
|
|
||||||
if (context) {
|
if (context) {
|
||||||
const fullFileName = getCssFileName();
|
const fullFileName = getCssFileName();
|
||||||
@@ -91,7 +91,6 @@ export function livesync(context?: HmrContext) {
|
|||||||
reapplyAppCss = extensions.some(ext => context.module === fileName.concat(ext));
|
reapplyAppCss = extensions.some(ext => context.module === fileName.concat(ext));
|
||||||
}
|
}
|
||||||
|
|
||||||
const rootView = getRootView();
|
|
||||||
if (reapplyAppCss && rootView) {
|
if (reapplyAppCss && rootView) {
|
||||||
rootView._onCssStateChange();
|
rootView._onCssStateChange();
|
||||||
} else if (liveSyncCore) {
|
} else if (liveSyncCore) {
|
||||||
|
|||||||
@@ -217,7 +217,8 @@ global.__onLiveSync = function __onLiveSync(context?: HmrContext) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
livesync(context);
|
const rootView = getRootView();
|
||||||
|
livesync(rootView, context);
|
||||||
};
|
};
|
||||||
|
|
||||||
function initLifecycleCallbacks() {
|
function initLifecycleCallbacks() {
|
||||||
|
|||||||
@@ -378,5 +378,6 @@ global.__onLiveSync = function __onLiveSync(context?: HmrContext) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
livesync(context);
|
const rootView = getRootView();
|
||||||
|
livesync(rootView, context);
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user