export function hasBrowserApi()

in src/schema/browser-apis.js [185:218]


export function hasBrowserApi(
  namespace,
  property,
  addonMetadata,
  apiSchemas = schemas
) {
  // We "have" the API if it's deprecated or temporary so we don't double warn.
  if (
    isTemporaryApi(namespace, property) ||
    isDeprecatedApi(namespace, property, addonMetadata, apiSchemas)
  ) {
    return true;
  }

  // We don't have the API if the extension manifest_version is outside of the
  // manifest_version range where the API is actually supported for.
  if (
    !isInSupportedManifestVersionRange(
      namespace,
      property,
      addonMetadata,
      apiSchemas
    )
  ) {
    return false;
  }

  // Or the schema entry for the API has an unsupported property set to true.
  const schema = apiSchemas[namespace];
  const schemaItem =
    getObjectProperty(schema, property) || getArrayProperty(schema, property);

  return schemaItem && !schemaItem.unsupported;
}