Javascript apps
January 5, 2016 — May 19, 2020
On the creation and testing of apps based on JavaScript and possibly HTML5 technology.
1 Web app
Sometimes the app you need can be a web app that you run on a web server and access through a browser, and that is okay.
1.1 On the internet
Covered elsewhere. It’s called the web. Except there is a wrinkle of interest to some of us: offline mode ServiceWorker
tech allows you to serve a web app even without connectivity. Sometimes an internet app is secretly a local app too. I don’t care enough about this to really understand the API. I just cargo-culted enough chunks of code to make it go. Seems to work.
Some of my friends recommend firebase for combo mobile/web app development. I don’t have opinions about it but it is noted here against future need.
1.2 Local dev website
I can do a lot by just hosting a webpage somewhere, and even some things with an HTML file on your hard disk, although these are locked down for security reasons.
So I can run a localhost dev server to have my own tiny local internet.
2 Runtimes
2.1 Node.js
node.js is a famous JavaScript runtime that brought JavaScript outside the browser environment. It was arguably the seed of the inflection point where there was massive uptake of JavaScript everywhere. Or at least JavaScript development.
Having used it for some toy projects I can verify that it is awful for toy projects. It leads to gigantic, complicated builds with massive dependencies. Just google npm dumpster fire
for many complaints about that. Tedious. Probably good for hip dotcoms? I do enjoy the ecosystem of handy utilities that people have built for node.js
though, just so long as I do not need to do any myself.
2.2 Deno
Deno is a reboot of Node.js by some Node.js people who wanted to avoid the horror of the various debilities in what they had created.
Deno is a simple, modern and secure runtime for JavaScript and TypeScript that uses V8 and is built in Rust.
- Secure by default. No file, network, or environment access, unless explicitly enabled.
- Supports TypeScript out of the box.
- Ships only a single executable file.
- Has built-in utilities like a dependency inspector (deno info) and a code formatter (deno fmt).
- Has a set of reviewed (audited) standard modules that are guaranteed to work with Deno: deno.land/std
Has this helped? I suspect it is too late.
3 Desktop embedded browser
Run a browser attached to your JavaScript app which renders all the UI and such. (Can also be made to run with, e.g. python GUIs.) Don’t learn some proprietary GUI framework, build a JavaScript GUI like everyone else. It’s not-too-hardish.
Now, choose your weapon:
I have no opinion about either of these, having not used either. Other people compare these two options.
- left field alternative: plask hosts a full 3D-friendly JavaScript runtime.
4 Tauri
5 Smartphone/desktop framework apps
AFAICT the hotness is Flutter
Flutter is Google’s UI toolkit for building beautiful, natively compiled applications for mobile, web, and desktop from a single codebase.
For tablets etc I should link to phonegap and cordova and titanium, but I am bored now. Build apps using JavaScript via Cordova or CocoonJS. Cordova takes HTML/JS apps to the mobile phone.
react-native is Facebook’s attempt to generalize to native apps, or something.
ionic builds on Cordova with native look-and-feel.
6 Chrome apps
Run it straight in your Chrome browser.
Cons:
- Weird script inclusion style that is not quite the native web
- doesn’t generalize to other browsers
Pros:
- more powerful than usual web pages (UDP!)
- instant web store
- Can include compiled C++ code via PNaCl
Howto:
chrome apps extension (essential)
chrome apps documentation (explanatory)
chrome dev editor is useful for building apps, but it has been abandoned for unspecified reasons
Frameworks need to support Content Security policy, whatever that is. At least two frameworks can handle this.
7 Use Dart instead
Dart is a language designed to work well for user interfaces which targets JavaScript or other native code. Maybe give that a burl instead.