Skip to content

Commit

Permalink
Add Startup Fix for Firefox CTX Menu (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
smashedr authored May 1, 2024
1 parent 20653f9 commit 535217f
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/js/service-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,29 @@

import { checkPerms, enableSite, requestPerms, toggleSite } from './export.js'

chrome.runtime.onStartup.addListener(onStartup)
chrome.runtime.onInstalled.addListener(onInstalled)
chrome.contextMenus.onClicked.addListener(onClicked)
chrome.commands.onCommand.addListener(onCommand)
chrome.runtime.onMessage.addListener(onMessage)
chrome.storage.onChanged.addListener(onChanged)

/**
* On Startup Callback
* @function onStartup
*/
async function onStartup() {
console.log('onStartup')
if (typeof browser !== 'undefined') {
console.log('Firefox CTX Menu Workaround')
const { options } = await chrome.storage.sync.get(['options'])
console.debug('options:', options)
if (options.contextMenu) {
createContextMenus()
}
}
}

/**
* Installed Callback
* @function onInstalled
Expand Down

0 comments on commit 535217f

Please sign in to comment.