Skip to content

Commit 818cf01

Browse files
committed
use createDocumentManifest
1 parent 2b195af commit 818cf01

2 files changed

Lines changed: 13 additions & 19 deletions

File tree

lib/runtime/impl-transmute.ts

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -311,25 +311,19 @@ export class TransmuteNativeDocument extends EventTarget implements NativeDocume
311311
return Promise.resolve(imageData as any);
312312
}
313313

314-
async ready(spatialDocument: SpatialDocumentImpl) {
315-
const metadata: DocumentMetadata = {
316-
specVersion: spatialDocument.querySelector('xsml')?.getAttribute('version'),
317-
};
318-
const descriptionMeta = spatialDocument.querySelector('meta[name="description"]');
319-
if (descriptionMeta) {
320-
metadata.description = descriptionMeta.getAttribute('content');
321-
}
322-
const authorMeta = spatialDocument.querySelector('meta[name="author"]');
323-
if (authorMeta) {
324-
metadata.author = authorMeta.getAttribute('content');
325-
}
326-
const licenseMeta = spatialDocument.querySelector('meta[name="license"]');
327-
if (licenseMeta) {
328-
metadata.license = licenseMeta.getAttribute('content');
329-
}
314+
async ready(dom: JSARDOM<TransmuteNativeDocument>) {
315+
const metadata = await dom.createDocumentManifest();
330316
await this.engine.onReady(this._scene, {
331-
title: spatialDocument.title,
332-
metadata,
317+
title: metadata.title,
318+
metadata: {
319+
specVersion: metadata.specVersion,
320+
description: metadata.description,
321+
author: metadata.author,
322+
keywords: metadata.keywords,
323+
license: metadata.license,
324+
licenseUrl: metadata.licenseUrl,
325+
viewportInitialScale: metadata.viewport?.initialScale,
326+
},
333327
});
334328
}
335329
}

lib/runtime/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ export class TransmuteRuntime extends EventTarget {
314314

315315
// FIXME: resolving the ready states for multiple documents.
316316
await dom.waitForSpaceReady(); // wait for the space ready.
317-
await nativeDocument.ready(dom.document);
317+
await nativeDocument.ready(dom);
318318

319319
// Dispatch the `documentcontentloaded` event?
320320
this.dispatchEvent(new DocumentContentLoadedEvent(dom.document));

0 commit comments

Comments
 (0)