Javascript apps

January 5, 2016 — May 19, 2020

computers are awful
javascript

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 webserver, and access through a browser and that is ok.

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/webapp development. I don’t have opinions about it but 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 files 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 run-time the brought javascript outside the browser environment. It was arguably the seed of the inflexion 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 sumpster 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.

  1. Secure by default. No file, network, or environment access, unless explicitly enabled.
  2. Supports TypeScript out of the box.
  3. Ships only a single executable file.
  4. Has built-in utilities like a dependency inspector (deno info) and a code formatter (deno fmt).
  5. 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 javsacript 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 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 generalise to native apps, or something.

ionic builds on cordova with native look-and-feel.

5 Chrome apps

Run it straight in your Chrome browser.

Cons:

  • Weird script inclusion style that is not quite the native web
  • doesn’t generalise to other browsers

Pros:

  • more powerful than usual web-pages (UDP!)
  • instant web store
  • Can include compiled C++ code vial PNaCl

Howto:

6 Use Dart instead

Dart is a languauge designed to work well for user interfaces which targets javascript or other native code. Maybe give that a burl instead.