Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function webviewLoaded(args: LoadEventData) {
webview = args.object;
if (isAndroid) {
webview.src = "http://10.0.2.2:8080";
} else {
webview.src = "http://localhost:8080";
}
webview.on(WebViewExt.shouldOverrideUrlLoadingEvent, (args: ShouldOverrideUrlLoadEventData) => {
console.log(args.url);
console.log(args.httpMethod);
if (args.url.indexOf("google.com") !== -1) {
args.cancel = true;
}
});
webview.on(WebViewExt.loadFinishedEvent, (args: LoadFinishedEventData) => {
console.log(`WebViewExt.loadFinishedEvent: ${args.url}`);
webview.loadStyleSheetFile("local-stylesheet.css", "~/assets/test-data/css/local-stylesheet.css", false);
});
webview.on("gotMessage", (msg) => {
gotMessageData = msg.data;
console.log(`webview.gotMessage: ${JSON.stringify(msg.data)} (${typeof msg})`);
});