The HoloJs app

HoloJs overview
HoloJs apps
HoloJs in Win32 apps
HoloJs in UWP apps
VR and AR experiences with Spin Sample script apps

HoloJs apps

The easiest way to create a HoloJs app is to generate one with Spin. You can then inspect the auto-generated app to understand it's structure.

The JSON file

A HoloJs app is comprised of JavaScript files and resource files alongside a JSON file that stores a list of these files:
{
    "scripts":["threejs/three.js", "app.js"],
    "resources":["media/images/crate.png"]
}

It is important that all scripts and resources reside under the same directory as the JSON file. Paths in the JSON file are resolved relative to the location of the JSON file itself. HoloJs will not read files outside of the app's directory.
For web hosted JSON files, scripts and resources are resolved relative to the base URL of the JSON file.
Note: All text files must be UTF8 encoded

The XRSX package

To simplify sharing of apps, the JSON file and all scripts and resources can be packaged in a XRSX file. HoloJs will automatically decompress and execute files with this extension.

The Spin tool can be used to create XRSX packages from a JSON file:
spin publish --source [path_to_app_json] --destination [path_to_xrs]

If crafting the XRSX file manually, please consider the following:

Script files

Rendering

WebVR

HoloJs apps should always attempt to render for WebVR. The underlying HoloJs runtime always initializes in VR mode if a headset is available (or on the HoloLens). Unlike in a web browser, the JavaScript code can request access to the VR headset without user input. Just execute this code:
navigator.getVRDisplays().then(
    function (value) {
        if (value.length > 0) {
        // Add code here to initialize your renderer for VR. This example assumes a ThreeJS renderer
        renderer.vr.enabled = true;
        renderer.vr.setDevice(value[0]);
        value[0].requestPresent([{ source: renderer.domElement }]);
    }
});
This code differs from a web browser code only by the fact that it can be called at any time, not just on a user action callback.
If a WebVR device is not available, the app can continue to render in simple mode.

WebAudio, Gamepad, Image, XmlHttpRequest, Blob

Work just like in a web browser.