The Open Ordinal Boostrap have some special extension that can be used during boot. These are helpers for specific use cases. More extensions are planned going forward.
There's two ways of loading additional resources (inscriptions) before bootstrap()
is called. This can be used to load assets and other things needed for you oridinal.
If the res
property of BootstrapOptions are specified the bootrapper will load these. All kinds of inscriptions can be loaded with this option.
The inscriptions will be loaded after bootstrap is started and before bootstrap()
is called in the loaded module.
All inscriptions are passed in to the bootstrap()
function as resources
as a Object
containing properties with data-URLs.
Example of Inscription
<script type="module">
import * as ooBS from '/content/<BootstrapInscriptionId>';
await ooBS.bootstrap({
...
res: {
// Load by Inscription Id
image: { id: "<InscriptionId>" },
model: { id: "<InscriptionId>" },
// Load Sat Id and Index
javascriptA: { sat: "<SatId>", index: 2 }
// Load latest by Sat Id
javascriptB: { sat: "<SatId>" }
}
...
});
</script>
Example of Ordinal code
export async function bootstrap(options, data, resources, ooModules) {
// Based on the code above resources will contain:
// {
// image: "data:image/jpeg;base64,/9j/4QAYRXhpZgAASUkqAAgAAA..."
// model: "data:model/gltf-binary;base64,Z2xURgIAAADIIQEAeBQ..."
// javascriptA: "data:text/javascript;base64,ZXhwb3J0IGFzeW5jIGZ1bm..."
// javascriptB: "data:text/javascript;base64,ZXhwb3J0IGFzeW5jIGZ1bm..."
// }
}
If you need other Open Ordinal modules available you can optionally use the bootstrap to load these during bootstrap.
If the oo
property of BootstrapOptions are specified the bootrapper will load these. The module-loader will allways load the latest version of these modules. When more Open Ordinal modules are available later this will be extended.
Example of Inscription
<script type="module">
import * as ooBS from '/content/<BootstrapInscriptionId>';
await ooBS.bootstrap({
...
oo: {
// Load Open Ordinal API module
api: true
}
...
});
</script>
Example of Ordinal code
export async function bootstrap(options, data, resources, ooModules) {
// Based on the code above ooModules will contain:
// {
// ooAPI: {Object}
// }
}