mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
chore: cleanup reexporting and TS 3.9 support
This commit is contained in:
@@ -5,7 +5,6 @@ import { File, knownFolders, path } from "../../file-system";
|
||||
|
||||
export { File, knownFolders, path };
|
||||
export * from "./web-view-interfaces";
|
||||
export * from "../core/view";
|
||||
|
||||
export const srcProperty = new Property<WebViewBase, string>({ name: "src" });
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { WebViewBase, knownFolders, traceEnabled, traceWrite, traceCategories, WebViewClient } from "./web-view-common";
|
||||
import { WebViewBase, knownFolders, WebViewClient } from "./web-view-common";
|
||||
import { isEnabled, write, categories } from '../../trace';
|
||||
|
||||
export * from "./web-view-common";
|
||||
|
||||
@@ -18,8 +19,8 @@ function initializeWebViewClient(): void {
|
||||
}
|
||||
|
||||
public shouldOverrideUrlLoading(view: android.webkit.WebView, url: string) {
|
||||
if (traceEnabled()) {
|
||||
traceWrite("WebViewClientClass.shouldOverrideUrlLoading(" + url + ")", traceCategories.Debug);
|
||||
if (isEnabled()) {
|
||||
write("WebViewClientClass.shouldOverrideUrlLoading(" + url + ")", categories.Debug);
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -29,8 +30,8 @@ function initializeWebViewClient(): void {
|
||||
super.onPageStarted(view, url, favicon);
|
||||
const owner = this.owner;
|
||||
if (owner) {
|
||||
if (traceEnabled()) {
|
||||
traceWrite("WebViewClientClass.onPageStarted(" + url + ", " + favicon + ")", traceCategories.Debug);
|
||||
if (isEnabled()) {
|
||||
write("WebViewClientClass.onPageStarted(" + url + ", " + favicon + ")", categories.Debug);
|
||||
}
|
||||
owner._onLoadStarted(url, undefined);
|
||||
}
|
||||
@@ -40,8 +41,8 @@ function initializeWebViewClient(): void {
|
||||
super.onPageFinished(view, url);
|
||||
const owner = this.owner;
|
||||
if (owner) {
|
||||
if (traceEnabled()) {
|
||||
traceWrite("WebViewClientClass.onPageFinished(" + url + ")", traceCategories.Debug);
|
||||
if (isEnabled()) {
|
||||
write("WebViewClientClass.onPageFinished(" + url + ")", categories.Debug);
|
||||
}
|
||||
owner._onLoadFinished(url, undefined);
|
||||
}
|
||||
@@ -59,8 +60,8 @@ function initializeWebViewClient(): void {
|
||||
|
||||
const owner = this.owner;
|
||||
if (owner) {
|
||||
if (traceEnabled()) {
|
||||
traceWrite("WebViewClientClass.onReceivedError(" + errorCode + ", " + description + ", " + failingUrl + ")", traceCategories.Debug);
|
||||
if (isEnabled()) {
|
||||
write("WebViewClientClass.onReceivedError(" + errorCode + ", " + description + ", " + failingUrl + ")", categories.Debug);
|
||||
}
|
||||
owner._onLoadFinished(failingUrl, description + "(" + errorCode + ")");
|
||||
}
|
||||
@@ -75,8 +76,8 @@ function initializeWebViewClient(): void {
|
||||
|
||||
const owner = this.owner;
|
||||
if (owner) {
|
||||
if (traceEnabled()) {
|
||||
traceWrite("WebViewClientClass.onReceivedError(" + error.getErrorCode() + ", " + error.getDescription() + ", " + (error.getUrl && error.getUrl()) + ")", traceCategories.Debug);
|
||||
if (isEnabled()) {
|
||||
write("WebViewClientClass.onReceivedError(" + error.getErrorCode() + ", " + error.getDescription() + ", " + (error.getUrl && error.getUrl()) + ")", categories.Debug);
|
||||
}
|
||||
owner._onLoadFinished(error.getUrl && error.getUrl(), error.getDescription() + "(" + error.getErrorCode() + ")");
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { NavigationType } from ".";
|
||||
import { WebViewBase, knownFolders, traceWrite, traceEnabled, traceCategories } from "./web-view-common";
|
||||
import { WebViewBase, knownFolders } from "./web-view-common";
|
||||
import { profile } from "../../profiling";
|
||||
import { isEnabled, write, categories } from '../../trace';
|
||||
export * from "./web-view-common";
|
||||
|
||||
class WKNavigationDelegateImpl extends NSObject
|
||||
@@ -38,22 +39,22 @@ class WKNavigationDelegateImpl extends NSObject
|
||||
}
|
||||
decisionHandler(WKNavigationActionPolicy.Allow);
|
||||
|
||||
if (traceEnabled()) {
|
||||
traceWrite("WKNavigationDelegateClass.webViewDecidePolicyForNavigationActionDecisionHandler(" + navigationAction.request.URL.absoluteString + ", " + navigationAction.navigationType + ")", traceCategories.Debug);
|
||||
if (isEnabled()) {
|
||||
write("WKNavigationDelegateClass.webViewDecidePolicyForNavigationActionDecisionHandler(" + navigationAction.request.URL.absoluteString + ", " + navigationAction.navigationType + ")", categories.Debug);
|
||||
}
|
||||
owner._onLoadStarted(navigationAction.request.URL.absoluteString, navType);
|
||||
}
|
||||
}
|
||||
|
||||
public webViewDidStartProvisionalNavigation(webView: WKWebView, navigation: WKNavigation): void {
|
||||
if (traceEnabled()) {
|
||||
traceWrite("WKNavigationDelegateClass.webViewDidStartProvisionalNavigation(" + webView.URL + ")", traceCategories.Debug);
|
||||
if (isEnabled()) {
|
||||
write("WKNavigationDelegateClass.webViewDidStartProvisionalNavigation(" + webView.URL + ")", categories.Debug);
|
||||
}
|
||||
}
|
||||
|
||||
public webViewDidFinishNavigation(webView: WKWebView, navigation: WKNavigation): void {
|
||||
if (traceEnabled()) {
|
||||
traceWrite("WKNavigationDelegateClass.webViewDidFinishNavigation(" + webView.URL + ")", traceCategories.Debug);
|
||||
if (isEnabled()) {
|
||||
write("WKNavigationDelegateClass.webViewDidFinishNavigation(" + webView.URL + ")", categories.Debug);
|
||||
}
|
||||
const owner = this._owner.get();
|
||||
if (owner) {
|
||||
@@ -72,8 +73,8 @@ class WKNavigationDelegateImpl extends NSObject
|
||||
if (webView.URL) {
|
||||
src = webView.URL.absoluteString;
|
||||
}
|
||||
if (traceEnabled()) {
|
||||
traceWrite("WKNavigationDelegateClass.webViewDidFailNavigationWithError(" + error.localizedDescription + ")", traceCategories.Debug);
|
||||
if (isEnabled()) {
|
||||
write("WKNavigationDelegateClass.webViewDidFailNavigationWithError(" + error.localizedDescription + ")", categories.Debug);
|
||||
}
|
||||
owner._onLoadFinished(src, error.localizedDescription);
|
||||
}
|
||||
@@ -86,8 +87,8 @@ class WKNavigationDelegateImpl extends NSObject
|
||||
if (webView.URL) {
|
||||
src = webView.URL.absoluteString;
|
||||
}
|
||||
if (traceEnabled()) {
|
||||
traceWrite("WKNavigationDelegateClass.webViewDidFailProvisionalNavigationWithError(" + error.localizedDescription + ")", traceCategories.Debug);
|
||||
if (isEnabled()) {
|
||||
write("WKNavigationDelegateClass.webViewDidFailProvisionalNavigationWithError(" + error.localizedDescription + ")", categories.Debug);
|
||||
}
|
||||
owner._onLoadFinished(src, error.localizedDescription);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user