A template for making a simple macOS app that has a webview UI. The app starts a HTTP server that the UI use to interact outside of the webview’s sandbox.
This repo is currently just a proof of concept, but I’m happy to make it more complete – it should take no longer than a week. If you’d like to use this and want it to be more mature, please open an issue and let me know what your use case is.
Things it can do:
I don’t know yet how to make it do these things:
Advantages compared to Electon:
brew install deno
This has been tested with Deno 1.5.1. webview
uses unstable Deno features, so the code might break with future versions of Deno will need to be re-adjusted. If you distribute the app with its own copy of Deno, then it’s not an issue for users – just for developers.
A few options:
deno run --no-check -A --unstable app.ts
bin/run
is an alias for this.--ui
to open the GUIMyApp.app
.
MyApp.app/Contents/MacOS/MyApp
does almost the same thing as the above.Known issue: deno_dir/gen/file
contains absolute paths rather than relative ones, which means the app is not completely self-contained yet.
Deno is very self-contained, and makes it easy to make Deno programs self-contained as well. Here are the steps neeeded to make MyApp.app
self-contained:
deno_dir
and run MyApp.app once, just to make we sure we have only the dependecies we need.src
into MyApp.app/Contents/Resources
.deno
executable into MyApp.app/Contents/Resources
.MyApp.app/Contents/MacOS/MyApp
to fix the path to the deno executable and the path of the working dir…These steps should be automated in the future, but they are not hard to do manually.
Author: szhu
Source Code: https://github.com/szhu/deno-webview-app-template
#deno #node #nodejs #javascript