-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoptions.js
19 lines (17 loc) · 878 Bytes
/
options.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
chrome.storage.local.get(['tooglWorkspaceId', 'togglAppiKey'], ({ tooglWorkspaceId, togglAppiKey }) => {
document.querySelector('#workspaceId').value = typeof tooglWorkspaceId !== 'undefined' ? tooglWorkspaceId : '';
document.querySelector('#apiKey').value = typeof togglAppiKey !== 'undefined' ? togglAppiKey : '';
});
document.querySelector('#saveSettingsBtn').addEventListener('click', () => {
workspaceId = document.querySelector('#workspaceId').value;
apiKey = document.querySelector('#apiKey').value;
chrome.storage.local.set({ tooglWorkspaceId: workspaceId, togglAppiKey: apiKey }, () => {
// todo validate api key.
// Update status to let user know options were saved.
const status = document.querySelector('#status');
status.textContent = 'Options saved.';
setTimeout(function () {
status.textContent = '';
}, 3000);
});
});