Skip to content

Instantly share code, notes, and snippets.

@psqq
Last active November 3, 2020 06:19
Show Gist options
  • Save psqq/5c9b1d4bf6b5cc3469fde370d73fafb8 to your computer and use it in GitHub Desktop.
Save psqq/5c9b1d4bf6b5cc3469fde370d73fafb8 to your computer and use it in GitHub Desktop.

Running

deno run -A --unstable https://gist.github.com/psqq/5c9b1d4bf6b5cc3469fde370d73fafb8/raw/29bbb3f19e9ba2f8b8e630ef1224d360281b8c9a/main.ts
// Importing the webview library
import { WebView } from "https://deno.land/x/webview/mod.ts";
// Creating an HTML page
let html = `
<html>
<body>
<input type="text"/>
Result: "<span></span>".
<script>
document.querySelector('input').addEventListener('keyup', function(e) {
var s = e.target.value;
var res = s.toLowerCase().split(' ').join('-');
document.querySelector('span').innerText = res;
});
</script>
</body>
</html>
`;
// Creating and configuring the webview
const webview = new WebView({
title: "Deno Webview Example",
url: "data:text/html," + html,
width: 800,
height: 600,
resizable: true,
debug: true,
frameless: false
});
// Running the webview
webview.run();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment