Javascript 从WebView调用Deno函数。怎么用?
我在网上找到了一个非常酷的例子,介绍了如何使用Deno运行Javascript 从WebView调用Deno函数。怎么用?,javascript,webview,deno,Javascript,Webview,Deno,我在网上找到了一个非常酷的例子,介绍了如何使用Deno运行WebView 是否可以从HTML模板中的HTML按钮元素调用Deno应用程序中的函数 看一看: // Importing the webview library import { WebView } from "https://deno.land/x/webview/mod.ts"; // Creating an HTML page let html = ` <html> <body&g
WebView
是否可以从HTML模板中的HTML按钮元素调用Deno应用程序中的函数
看一看:
// Importing the webview library
import { WebView } from "https://deno.land/x/webview/mod.ts";
// Creating an HTML page
let html = `
<html>
<body>
<h1>Hello from deno v${Deno.version.deno}</h1>
<button type="button" onclick="test()">RUN TEST FUNCTION</button>
</body>
</html>
`;
function test() {
console.log('You really can do that!');
}
// Creating and configuring the webview
const webview = new WebView({
title: "Deno Webview Example",
url: "data:text/html," + html,
// url: 'https://www.google.com',
width: 768,
height: 1024,
resizable: true,
debug: true,
frameless: false
});
// Running the webview
webview.run();
到目前为止,deno双向绑定似乎还不存在。是的,通过创建https服务器并侦听
WebView
客户端想要的任何请求。否则,我真的不知道这样做能实现什么。你可以通过一个非常好的Javascript和HTML渲染引擎在桌面上实现webapp功能。
deno run -A --unstable webview.ts