Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/400.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 从WebView调用Deno函数。怎么用?_Javascript_Webview_Deno - Fatal编程技术网

Javascript 从WebView调用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

我在网上找到了一个非常酷的例子,介绍了如何使用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>
        <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