Skip to content

Commit 43fbabb

Browse files
author
Hristo Hristov
authored
Fixed most module cyclic references. There is one left for ios and android: (NativeScript#4978)
- http -> http-request -> image-source that can't be fixed easily and will be removed once we delete image-source module because it is obsolete anyway. There is one more for android: - frame -> fragment that could be removed if we use global object. Updated madge bersion
1 parent 729b068 commit 43fbabb

File tree

19 files changed

+227
-236
lines changed

19 files changed

+227
-236
lines changed

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"grunt-ts": "6.0.0-beta.11",
2828
"grunt-typedoc": "0.2.4",
2929
"http-server": "^0.9.0",
30-
"madge": "^2.0.0",
30+
"madge": "^2.2.0",
3131
"markdown-snippet-injector": "0.2.2",
3232
"mocha": "^3.5.0",
3333
"mocha-typescript": "^1.1.9",
@@ -80,6 +80,8 @@
8080
"test-tsc-es2016": "npm run tsc -- -p tsconfig.public.es2016.json",
8181
"tslint": "tslint --config build/tslint.json 'tns-core-modules/**/*.ts' 'tests/**/*.ts' 'apps/**/*.ts' -e '**/node_modules/**' -e '**/platforms/**'",
8282
"madge-ios": "tsc --skipLibCheck && tns prepare ios --path tests && madge --circular tests/platforms/ios/tests/app/tns_modules/tns-core-modules",
83-
"madge-android": "tsc --skipLibCheck && tns prepare android --path tests && madge --circular tests/platforms/android/src/main/assets/app/tns_modules/tns-core-modules"
83+
"madge-ios-image": "tsc --skipLibCheck && tns prepare ios --path tests && madge --image graph-tests-ios.svg tests/platforms/ios/tests/app/tns_modules/tns-core-modules",
84+
"madge-android": "tsc --skipLibCheck && tns prepare android --path tests && madge --circular tests/platforms/android/src/main/assets/app/tns_modules/tns-core-modules",
85+
"madge-android-image": "tsc --skipLibCheck && tns prepare android --path tests && madge --image graph-tests-android.svg tests/platforms/android/src/main/assets/app/tns_modules/tns-core-modules"
8486
}
8587
}

tns-core-modules/application/application-common.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ export { Observable };
1919

2020
import { UnhandledErrorEventData, iOSApplication, AndroidApplication, CssChangedEventData, LoadAppCSSEventData } from ".";
2121

22+
export { UnhandledErrorEventData, CssChangedEventData, LoadAppCSSEventData };
23+
2224
export const launchEvent = "launch";
2325
export const suspendEvent = "suspend";
2426
export const displayedEvent = "displayed";
@@ -54,7 +56,11 @@ export function setApplication(instance: iOSApplication | AndroidApplication): v
5456
}
5557

5658
export function livesync() {
57-
events.notify(<EventData>{ eventName: "livesync", object: app });
59+
events.notify(<EventData>{ eventName: "livesync", object: app });
60+
const liveSyncCore = global.__onLiveSyncCore;
61+
if (liveSyncCore) {
62+
liveSyncCore();
63+
}
5864
}
5965

6066
export function setCssFileName(cssFileName: string) {
@@ -76,4 +82,4 @@ export function addCss(cssText: string): void {
7682

7783
global.__onUncaughtError = function (error: NativeScriptError) {
7884
events.notify(<UnhandledErrorEventData>{ eventName: uncaughtErrorEvent, object: app, android: error, ios: error, error: error });
79-
}
85+
}

tns-core-modules/file-system/file-name-resolver/file-name-resolver.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { PlatformContext, FileNameResolver as FileNameResolverDefinition } from
22
import { screen, device } from "../../platform";
33
import { path as fsPath, Folder, File } from "../file-system";
44
import * as trace from "../../trace";
5-
import * as appModule from "../../application";
5+
import * as appCommonModule from "../../application/application-common";
66

77
const MIN_WH: string = "minWH";
88
const MIN_W: string = "minW";
@@ -234,5 +234,5 @@ export function resolveFileName(path: string, ext: string): string {
234234
return resolverInstance.resolveFileName(path, ext);
235235
}
236236

237-
appModule.on("cssChanged", args => resolverInstance = undefined);
238-
appModule.on("livesync", args => resolverInstance && resolverInstance.clearCache());
237+
appCommonModule.on("cssChanged", args => resolverInstance = undefined);
238+
appCommonModule.on("livesync", args => resolverInstance && resolverInstance.clearCache());

0 commit comments

Comments
 (0)