Skip to content

Commit

Permalink
fix: context menus created only on first install
Browse files Browse the repository at this point in the history
  • Loading branch information
amithm7 committed May 29, 2021
1 parent 92c907a commit a495e00
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 19 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "webext-open-player",
"version": "0.3.0",
"version": "0.3.1",
"description": "Open URLs (video) in mpv, vlc, etc",
"main": "src/background.js",
"scripts": {
Expand Down
32 changes: 15 additions & 17 deletions src/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,23 +42,21 @@ function listenMenu (player) {
});
}

// Create menu on install / reload
chrome.runtime.onInstalled.addListener(function () {
// Storage keys in namespace 'local' (storage area)
chrome.storage.local.get({
defaultPlayer: 'mpv',
players: {
mpv: true,
vlc: true
}
}, function (items) {
if(items.players.mpv) {
createMenu('mpv');
}
if(items.players.vlc) {
createMenu('vlc');
}
});
// Create menu
// Storage keys in namespace 'local' (storage area)
chrome.storage.local.get({
defaultPlayer: 'mpv',
players: {
mpv: true,
vlc: true
}
}, function (items) {
if(items.players.mpv) {
createMenu('mpv');
}
if(items.players.vlc) {
createMenu('vlc');
}
});

// Create listeners for menu items and extension button
Expand Down
2 changes: 1 addition & 1 deletion src/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "Open in Player",
"version": "0.3.0",
"version": "0.3.1",
"description": "Open URLs (video) in mpv, vlc, etc",
"icons": {
"128": "ico/video.png"
Expand Down

0 comments on commit a495e00

Please sign in to comment.