-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoptions.js
More file actions
22 lines (20 loc) · 776 Bytes
/
options.js
File metadata and controls
22 lines (20 loc) · 776 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Saves options to chrome.storage
function save_options() {
var enableFeature = document.getElementById('enableFeature').checked;
chrome.storage.sync.set({
enableFeature: enableFeature
}, function() {
// Update status to let user know options were saved.
console.log('Settings saved.');
});
}
// Restores checkbox state using the preferences stored in chrome.storage
function restore_options() {
chrome.storage.sync.get({
enableFeature: true // default value
}, function(items) {
document.getElementById('enableFeature').checked = items.enableFeature;
});
}
document.addEventListener('DOMContentLoaded', restore_options);
document.getElementById('enableFeature').addEventListener('change', save_options);