Instances
Ozone Home is the default Ozone Shell with all the default applications that expects you to use multiple suites of applications.
But if you are building a suite of applications and want to ship them entirely on your domain, or ship your own set of default apps, you can build an Ozone instance, and they are surprisingly easy to setup.
If i can ship an instance, why should i ship for an Ozone Home?
- Ozone Home is for general distribution and integration to the larger Ozone ecosystem.
- Instances are for controlled, product-specific use-cases where you have to define the entire user experience.
Ozone Home Ozone Instance
- Uses Ozone default apps
- No duplication of apps and files, you can directly integrate.
- Already installed. No initial setup required.
- Installation of apps are straightforward through default Store app index.
- Makes its own copies of applications
- Duplicated apps if you distribute Home Default apps.
- Users and developer has to configure the initial setup.
- if developer didn't provide, no straightforward app installation support.
How to make an Instance
Grab ozone.js and sw.js from the official repo's dist directory. This is the entire Ozone Shell.
These scripts can be stored anywhere in your project. You just have to initialize ozone (step 1, given below) using the ozone.js script. Both these scripts must be in the same directory level.
/
index.html inital page of the instance
versions.json versioning file
/[source] this default app directory path can be configured during initialization
/app_1
manifest.json
/[ozone]
ozone.js
sw.jsInitial page
Initial
-
initialization
import { Ozone } from "./ozone/ozone.js" // path to imported ozone.js const ozone = new Ozone({ defaultApps: ["app_1", "app_2"], sourceURL: "/source" })The Ozone class needs to be initialized with an instance configuration object which tells ozone how to configure your Instance.
DefaultAppsandsourceURLtogether decide the URL of every default app. For example, if sourceURL is/sourceand defaultApps is["app_1"], the URL/source/app_1/will be installed.Version FileThe key,
versionURLshould have a URL of a JSON file as value. This JSON file is used to update the service worker remotely for every user of your Ozone instance.The SW will update if the
oswarekey in the JSON file is updated. The key can have any value, though an incrementing number is recommended.List of keys for the instance configuration objectkey value type description defaultAppsarray of strings list of all default application directories located inside the sourceURL to install during Ozone install sourceURLstring provides a source URL for applications to be installed as default apps. sharedAssetsarray of strings list of all files required to be installed in the /sharedAssetsfolder.swKeystring a name for the service worker version tracking variable dbNamestring a name for the VFS database versionURLstring URL for the service worker version provider JSON file. -
Ensuring service worker exists
ozone.ensureServiceWorker() -
Installation
ozone.install() -
Update default apps
ozone.update() -
Reset / empty Ozone
ozone.reset()
Debugging an Ozone Instance
There are multiple ways to debug your ozone instance, this can be done by using the official system application package, even without installing or shipping them in your instance.
Using LiveReload
You can use liveReload query param in order to load an Ozone Home system app on your Instance. Given below is a liveReload URL that lets you load Files App.
YOUR_OZONE_URL/apps/anything/anything/?livereload=https://ozoneshell.github.io/defaultSource/files/You can also use other apps like settings, store , menu or text
