feat(assets): publish reusable area packages
This commit is contained in:
13
examples/asset-package-resolver.js
Normal file
13
examples/asset-package-resolver.js
Normal file
@@ -0,0 +1,13 @@
|
||||
"use strict";
|
||||
|
||||
function resolveAsset(manifestUrl, manifest, id = "main") {
|
||||
const asset = manifest.assets.find((candidate) => candidate.id === id);
|
||||
if (!asset) throw new Error(`Unknown asset '${id}'`);
|
||||
return new URL(asset.uri, manifestUrl).href;
|
||||
}
|
||||
|
||||
function placement(manifest) {
|
||||
return { ...manifest.placement, coordinateSystem: manifest.coordinateSystem };
|
||||
}
|
||||
|
||||
module.exports = { resolveAsset, placement };
|
||||
Reference in New Issue
Block a user