mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
chore: remove critical circular dependencies (#8114)
* chore: remove critical circular dependencies * chore: fix tslint errors * chore: remove platform specific types from interfaces * chore: update unit tests polyfills * fix: incorrect null check * chore: update api.md file * test: improve test case * chore: apply comments * test: avoid page style leaks in tests
This commit is contained in:
committed by
Alexander Vakrilov
parent
5b647bd809
commit
0ffc790d82
@@ -1,8 +1,10 @@
|
||||
import { WebView as WebViewDefinition, LoadEventData, NavigationType } from ".";
|
||||
import { WebView as WebViewDefinition } from ".";
|
||||
import { LoadEventData, NavigationType } from "./web-view-interfaces";
|
||||
import { ContainerView, Property, EventData, CSSType } from "../core/view";
|
||||
import { File, knownFolders, path } from "../../file-system";
|
||||
|
||||
export { File, knownFolders, path, NavigationType };
|
||||
export { File, knownFolders, path };
|
||||
export * from "./web-view-interfaces";
|
||||
export * from "../core/view";
|
||||
|
||||
export const srcProperty = new Property<WebViewBase, string>({ name: "src" });
|
||||
@@ -87,6 +89,10 @@ export abstract class WebViewBase extends ContainerView implements WebViewDefini
|
||||
}
|
||||
}
|
||||
|
||||
// HACK: Use an interface with the same name, so that the class above fulfills the 'implements' requirement
|
||||
// HACK: We use the 'implements' to verify the class above is the same as the one declared in the d.ts
|
||||
// HACK: We declare all these 'on' statements, so that they can appear in the API reference
|
||||
// HACK: Do we need this? Is it useful? There are static fields to the WebViewBase class for the event names.
|
||||
export interface WebViewBase {
|
||||
on(eventNames: string, callback: (data: EventData) => void, thisArg?: any);
|
||||
on(event: "loadFinished", callback: (args: LoadEventData) => void, thisArg?: any);
|
||||
|
||||
14
nativescript-core/ui/web-view/web-view-interfaces.ts
Normal file
14
nativescript-core/ui/web-view/web-view-interfaces.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { WebView } from ".";
|
||||
import { EventData } from "../core/view";
|
||||
|
||||
export type NavigationType = "linkClicked" | "formSubmitted" | "backForward" | "reload" | "formResubmitted" | "other" | undefined;
|
||||
|
||||
export interface LoadEventData extends EventData {
|
||||
url: string;
|
||||
navigationType: NavigationType;
|
||||
error: string;
|
||||
}
|
||||
|
||||
export interface WebViewClient {
|
||||
new(owner: WebView): any /* android.webkit.WebViewClient */;
|
||||
}
|
||||
@@ -1,11 +1,7 @@
|
||||
import { WebViewBase, knownFolders, traceEnabled, traceWrite, traceCategories } from "./web-view-common";
|
||||
import { WebViewBase, knownFolders, traceEnabled, traceWrite, traceCategories, WebViewClient } from "./web-view-common";
|
||||
|
||||
export * from "./web-view-common";
|
||||
|
||||
interface WebViewClient {
|
||||
new(owner: WebView): android.webkit.WebViewClient;
|
||||
}
|
||||
|
||||
let WebViewClient: WebViewClient;
|
||||
|
||||
function initializeWebViewClient(): void {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { WebViewBase, knownFolders, traceWrite, traceEnabled, traceCategories, NavigationType } from "./web-view-common";
|
||||
import { NavigationType } from ".";
|
||||
import { WebViewBase, knownFolders, traceWrite, traceEnabled, traceCategories } from "./web-view-common";
|
||||
import { profile } from "../../profiling";
|
||||
export * from "./web-view-common";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user