[w3c/manifest] Add API to fetch the current document's calculated manifest (Issue #1179)

dmurph created an issue (w3c/manifest#1179)

Devs want to be able to fetch the document's current manifest state, and possible get other metadata, for production code & testing.

Some possible ideas:
```js
let manifest;
try {
 manifest = await document.getManifest();
} catch (e) {
  // handle network error, parsing error, etc.
}
console.log(manifest.id);
// Is metadata needed?
let metadata = manifest.getMetadata();
// The manifest is always populated with defaults
console.log(metadata.isDefaultManifest);
```
or maybe
```js
let data;
try {
  data = await document.getManifest();
} catch (e) {
   // handle network error, parsing error, etc.
}
let manifest = data.manifest;
console.log(manifest.id);
let metadata = data.metadata;
let isDefault = metadata.isDefault;
```
or maybe
```js
let manifest;
try {
  manifest = await document.getManifest({excludeDefaultManifest: true});
} catch (e) {
     // handle network error, parsing error, etc.
}
if (manifest != null) {
  console.log(manifest.id);
}
```

-- 
Reply to this email directly or view it on GitHub:
https://github.com/w3c/manifest/issues/1179
You are receiving this because you are subscribed to this thread.

Message ID: <w3c/manifest/issues/1179@github.com>

Received on Monday, 7 July 2025 16:44:25 UTC