0.5.1 • Published 4 years ago

webextensions-schema v0.5.1

Weekly downloads
16
License
MPL-2.0
Repository
github
Last release
4 years ago

WebExtensions Schema

Programmatically consume the WebExtensions Schema JSON files. Defaults to the latest stable ones.

Install

npm i webextensions-schema

Usage

import webExtensionsSchema from 'webextensions-schema';

(async () => {
  const schema = await webExtensionsSchema();
  // do something with `schema`
})();

API

webExtensionsSchema(options)

  • Arguments
    • {Object} options
      • tag 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.

schema.raw()

Returns an Object with schema filename as key and parsed JSON as value.

Sample:

{
  'tabs.json': [
    { namespace: 'manifest', types: [Array] },
    {
      namespace: 'tabs',
      ...
    }
  ]
}

schema.namespaces()

Returns an Object with namespace name as key and an Array of namespaces as value.

Sample:

{
  manifest: [
    { namespace: 'manifest', types: [Array] },
    { namespace: 'manifest', types: [Array] },
    ...
  ],
  tabs: [
    {
      namespace: 'tabs',
      functions: [
        [Object], [Object], [Object],
        ...
      ]
    }
  ]
}

schema.tag()

Returns a string with tag name that was used for the schema instance.

0.5.1

4 years ago

0.5.0

4 years ago

0.4.0

4 years ago

0.3.0

4 years ago

0.2.0

4 years ago

0.1.9

4 years ago

0.1.8

4 years ago

0.1.7

4 years ago

0.1.6

4 years ago

0.1.5

4 years ago

0.1.4

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago