Skip to content

Commit

Permalink
Fix: open-manager has no default value
Browse files Browse the repository at this point in the history
  • Loading branch information
eight04 committed Oct 4, 2018
1 parent 874a2da commit 3af310c
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions background/background.js
Expand Up @@ -202,11 +202,10 @@ if (chrome.contextMenus) {
}
item = Object.assign({id}, item);
delete item.presentIf;
const prefValue = prefs.get(id);
item.title = chrome.i18n.getMessage(item.title);
if (!item.type && typeof prefValue === 'boolean') {
if (!item.type && typeof prefs.defaults[id] === 'boolean') {
item.type = 'checkbox';
item.checked = prefValue;
item.checked = prefs.get(id);
}
if (!item.contexts) {
item.contexts = ['browser_action'];
Expand All @@ -230,7 +229,7 @@ if (chrome.contextMenus) {
};

const keys = Object.keys(contextMenus);
prefs.subscribe(keys.filter(id => typeof prefs.get(id) === 'boolean'), toggleCheckmark);
prefs.subscribe(keys.filter(id => typeof prefs.defaults[id] === 'boolean'), toggleCheckmark);
prefs.subscribe(keys.filter(id => contextMenus[id].presentIf), togglePresence);
createContextMenus(keys);
}
Expand Down

0 comments on commit 3af310c

Please sign in to comment.