示例#1
0
        public static void MapEval(WebViewHandler handler, IWebView webView, object?arg)
        {
            if (arg is not string script)
            {
                return;
            }

            handler.PlatformView?.Eval(webView, script);
        }
示例#2
0
        public static void MapEvaluateJavaScriptAsync(WebViewHandler handler, IWebView webView, object?arg)
        {
            if (arg is EvaluateJavaScriptAsyncRequest request)
            {
                if (handler.PlatformView == null)
                {
                    request.SetCanceled();
                    return;
                }

                handler.PlatformView.EvaluateJavaScript(request);
            }
        }
示例#3
0
        public static async void MapReload(WebViewHandler handler, IWebView webView, object?arg)
        {
            try
            {
                var url = ((MauiWKWebView)handler.PlatformView).CurrentUrl;

                if (url != null)
                {
                    await handler.SyncPlatformCookiesAsync(url);
                }
            }
            catch (Exception exc)
            {
                handler.MauiContext?.CreateLogger <WebViewHandler>()?.LogWarning(exc, "Syncing Existing Cookies Failed");
            }

            handler.PlatformView?.UpdateReload(webView);
        }
        public static void MapSource(WebViewHandler handler, IWebView webView)
        {
            IWebViewDelegate?webViewDelegate = handler.NativeView as IWebViewDelegate;

            handler.NativeView?.UpdateSource(webView, webViewDelegate);
        }
示例#5
0
 public static void MapReload(WebViewHandler handler, IWebView webView, object?arg)
 {
     handler.PlatformView?.UpdateReload(webView);
 }
示例#6
0
 public static void MapGoForward(WebViewHandler handler, IWebView webView, object?arg)
 {
     handler.PlatformView?.UpdateGoForward(webView);
 }