Developing

Diva.js is built from two main pieces: an Elm application that manages state and UI, and a TypeScript layer that provides the custom OpenSeadragon viewer element and bridges Elm ports to the browser.

Architecture Overview

Key source files:

Key Technologies

Development Setup

Prerequisites:

Install dependencies:

yarn install

Building

The production bundle can be built with Make.

make clean && make build

This command will create the build/diva.js file, which is minified and stripped of any debugging information.

We also ship a debug build that can help track down integration problems.

make build-dev

This command will create build/diva.debug.js, which you can load in place of diva.js. It will give you access to the Elm “time travel debugger” to see the internal state of the application.

You can also watch for changes and re-build the debug build as you develop.

yarn run develop

It is probably helpful to run a local web server as you develop.

python3 -m http.server 8000

Then open:

Formatting

We have a weird thing with using Allman style in the TypeScript files. To reformat the TypeScript we use clang-format, and this can be invoked with yarn:

yarn run format