UNPKG

@nota/nativescript-webview-ext

Version:

Extended WebView for NativeScript which adds 'x-local' scheme for local-files. events between WebView and native-layer, javascript execution, injecting CSS and JS-files.

70 lines (69 loc) 3.66 kB
/// <reference path="platforms/ios/NotaWebViewExt.d.ts" /> import { IOSWebViewWrapper, WebViewExtBase } from "./webview-ext-common"; export declare class WKNavigationDelegateImpl extends NSObject implements WKNavigationDelegate { static ObjCProtocols: { prototype: WKNavigationDelegate; }[]; static initWithOwner(owner: WeakRef<WebViewExtBase>): WKNavigationDelegateImpl; private owner; webViewDecidePolicyForNavigationActionDecisionHandler(webView: WKWebView, navigationAction: WKNavigationAction, decisionHandler: any): void; webViewDidStartProvisionalNavigation(webView: WKWebView, navigation: WKNavigation): void; webViewDidFinishNavigation(webView: WKWebView, navigation: WKNavigation): void; webViewDidFailNavigationWithError(webView: WKWebView, navigation: WKNavigation, error: NSError): void; } export declare class WKScriptMessageHandlerImpl extends NSObject implements WKScriptMessageHandler { static ObjCProtocols: { prototype: WKScriptMessageHandler; }[]; private owner; static initWithOwner(owner: WeakRef<WebViewExtBase>): WKScriptMessageHandlerImpl; userContentControllerDidReceiveScriptMessage(userContentController: WKUserContentController, webViewMessage: WKScriptMessage): void; } export declare class WKWebViewWrapper implements IOSWebViewWrapper { protected wkWebViewConfiguration: WKWebViewConfiguration; protected wkNavigationDelegate: WKNavigationDelegateImpl; protected wkCustomUrlSchemeHandler: CustomUrlSchemeHandler; protected wkUserContentController: WKUserContentController; protected wkUserScriptInjectWebViewBrigde: Promise<WKUserScript> | void; protected wkUserScriptViewPortCode: Promise<WKUserScript>; protected wkNamedUserScripts: { resourceName: string; wkUserScript: WKUserScript; }[]; owner: WeakRef<WebViewExtBase>; readonly ios: WKWebView | void; readonly shouldInjectWebViewBridge = false; readonly autoInjectJSBridge: boolean; constructor(owner: WebViewExtBase); createNativeView(): WKWebView; initNativeView(): void; disposeNativeView(): void; onLoaded(): void; onUnloaded(): void; loadUrl(src: string): void; loadData(content: string): void; readonly canGoBack: boolean; readonly canGoForward: boolean; goBack(): void; goForward(): void; reload(): void; executeJavaScript(scriptCode: string): Promise<any>; stopLoading(): void; fixLocalResourceName(resourceName: string): string; registerLocalResourceForNative(resourceName: string, filepath: string): void; unregisterLocalResourceForNative(resourceName: string): void; getRegisteredLocalResourceFromNative(resourceName: string): string; autoLoadStyleSheetFile(resourceName: string, filepath: string, insertBefore?: boolean): void; removeAutoLoadStyleSheetFile(resourceName: string): void; autoLoadJavaScriptFile(resourceName: string, path: string): Promise<void>; removeAutoLoadJavaScriptFile(resourceName: string): void; protected loadWKUserScripts(autoInjectJSBridge?: boolean): void; protected makeWKUserScriptPromise(scriptCodePromise: Promise<string>): Promise<WKUserScript>; protected addUserScriptFromPromise(userScriptPromise: Promise<WKUserScript>): Promise<void>; protected addUserScript(userScript: WKUserScript): void; protected addNamedWKUserScript(resourceName: string, scriptCode: string): void; protected removeNamedWKUserScript(resourceName: string): void; protected createWkUserScript(source: string): WKUserScript; enableAutoInject(enable: boolean): void; scrollBounce: boolean; }