Programmatically consume the WebExtensions Schema JSON files
npm install webextensions-schemaProgrammatically consume the WebExtensions Schema JSON files. Defaults to the latest stable ones.
```
npm i webextensions-schema
`ts
import webExtensionsSchema from 'webextensions-schema';
(async () => {
const schema = await webExtensionsSchema();
// do something with schema`
})();
- Arguments
- {Object} optionstag
- Any tag, except tip, from mozilla-unified is valid. Default: Automatically fetches the latest stable release tag from download.mozilla.org.
Schema files for a tag that don't exist in the .schemas
directory
are downloaded once and saved there for future calls. Already ships with some
schema files (feel free to PR to add newer ones).
Returns a Promise resolving to the schema instance.
Returns an Object with schema filename as key and parsed JSON as value.
Sample:
`js`
{
'tabs.json': [
{ namespace: 'manifest', types: [Array] },
{
namespace: 'tabs',
...
}
]
}
Returns an Object with namespace name as key and an Array of namespaces as value.
Sample:
`js`
{
manifest: [
{ namespace: 'manifest', types: [Array] },
{ namespace: 'manifest', types: [Array] },
...
],
tabs: [
{
namespace: 'tabs',
functions: [
[Object], [Object], [Object],
...
]
}
]
}
Returns a string with tag name that was used for the schema` instance.