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() {
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import { Frame, NavigationEntry } from "../ui/frame";
|
|||||||
import * as utils from "../utils/utils";
|
import * as utils from "../utils/utils";
|
||||||
import { profile, level as profilingLevel, Level } from "../profiling";
|
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:
|
// TODO: Refactor the UIResponder to use Typescript extends when this issue is resolved:
|
||||||
// https://github.com/NativeScript/ios-runtime/issues/1012
|
// https://github.com/NativeScript/ios-runtime/issues/1012
|
||||||
var Responder = (<any>UIResponder).extend({
|
var Responder = (<any>UIResponder).extend({
|
||||||
@@ -161,7 +161,7 @@ class IOSApplication implements IOSApplicationDefinition {
|
|||||||
this.setWindowContent(args.root);
|
this.setWindowContent(args.root);
|
||||||
} else {
|
} else {
|
||||||
this._window = UIApplication.sharedApplication.delegate.window;
|
this._window = UIApplication.sharedApplication.delegate.window;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@profile
|
@profile
|
||||||
@@ -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