How to use the webextension-polyfill.management function in webextension-polyfill

To help you get started, we’ve selected a few webextension-polyfill examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cliffordfajardo / cato / app / plugins / disable-extensions / index.js View on Github external
  extensions.forEach((extension) => browser.management.setEnabled(extension.id, false))
  window.close()
github cliffordfajardo / cato / app / plugins / disable-extensions / index.js View on Github external
async function disableAllExtensions() {
  const extensionsAndApps = await browser.management.getAll()
  const extensions = extensionsAndApps
    .filter((extensionOrApp) => {
      return extensionOrApp.type === 'extension' &&
        extensionOrApp.name !== "Cato"
    })
  extensions.forEach((extension) => browser.management.setEnabled(extension.id, false))
  window.close()
}
github cliffordfajardo / cato / app / plugins / disable-extension / index.js View on Github external
action: async () => {
          await browser.management.setEnabled(extension.id, false)
          window.close()
        },
        icon: {
github cliffordfajardo / cato / app / plugins / disable-extension / index.js View on Github external
async function displayActiveExtensions() {
  window.currentSearchSuggestions = []

  if (!plugin.valid) {
    window.searchInput.value = `${plugin.searchScope} `
    window.searchResultsList.innerHTML = ""

    const extensionsAndApps = await browser.management.getAll()
    let extensions = extensionsAndApps.filter((extensionOrApp) => {
      return extensionOrApp.type === 'extension' &&
        extensionOrApp.name !== "Cato" &&
        extensionOrApp.enabled
    })

    extensions = sortBy(extensions, ['name'])

    window.currentSearchSuggestions = extensions.map((extension) => {
      const action = {
        keyword: `${extension.name}`,
        action: async () => {
          await browser.management.setEnabled(extension.id, false)
          window.close()
        },
        icon: {
github cliffordfajardo / cato / app / plugins / uninstall-extension / index.js View on Github external
return async function closureFunc() {
    const options = {showConfirmDialog: true}
    await browser.management.uninstall(extension.id, options)
  }
}
github cliffordfajardo / cato / app / plugins / uninstall-extension / index.js View on Github external
async function uninstallExtension() {
  window.searchInput.value = ''
  window.searchResultsList.innerHTML = ""

  if (!plugin.valid) {
    window.searchInput.value = `${plugin.keyword} `
    window.searchResultsList.innerHTML = ""
    const extensionsAndApps = await browser.management.getAll()
    let extensions = extensionsAndApps
    .filter((extensionOrApp) => {
      return extensionOrApp.type === 'extension' &&
      extensionOrApp.name !== "Awesome Task Launcher"
    })

    extensions = sortBy(extensions, ['name'])

    window.currentSearchSuggestions = extensions.map((extension) => {
      const action = {
        'keyword': `${extension.name}`,
        'action': uninstall(extension),
        'icon': {
          path: utils.useAvalableExtensionIcon(extension)
        }
      }
github faceit-enhancer / faceit-enhancer / src / background / index.js View on Github external
browser.runtime.onInstalled.addListener(async ({ reason, previousVersion }) => {
  if (reason === 'update') {
    const { installType } = await browser.management.getSelf()

    if (installType === 'development') {
      return
    }

    const { version } = browser.runtime.getManifest()

    const versionDiffType = semverDiff(previousVersion, version)
    if (versionDiffType === null || versionDiffType === 'patch') {
      return
    }

    const changelogUrl = changelogs[version]

    if (changelogUrl) {
      const {
github waynecz / dadda-translate-crx / src / hot-reload-extension.ts View on Github external
;(async (): Promise => {
  const self = await browser.management.getSelf()
  if (self.installType === 'development') {
    browser.runtime.getPackageDirectoryEntry(dir => watchChanges(dir))
  }
})()
github AztecProtocol / AZTEC / packages / extension / src / utils / hot-reload.js View on Github external
}

    browser.runtime.reload();
};

const watchChanges = (dir, lastTimestamp) => {
    timestampForFilesInDirectory(dir).then((timestamp) => {
        if (!lastTimestamp || (lastTimestamp === timestamp)) {
            setTimeout(() => watchChanges(dir, timestamp), 1000);
        } else {
            reload();
        }
    });
};

browser.management.getSelf()
    .then((self) => {
        if (self.installType === 'development') {
            browser.runtime.getPackageDirectoryEntry(dir => watchChanges(dir));
        }
    });