如何解决从WebView调用Deno函数怎么样?
我在网上发现了一个非常酷的示例,说明如何使用Deno运行WebView
。
是否可以从放置在html模板中的HTML按钮元素中调用Deno App内部的函数?
看看:
// 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 run -A --unstable webview.ts
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。