-
Notifications
You must be signed in to change notification settings - Fork 0
/
options.js
21 lines (19 loc) · 713 Bytes
/
options.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
function saveOptions(e) {
e.preventDefault();
chrome.storage.local.set({
apiEmojiKey: document.querySelector("#apiEmojiKey").value
});
chrome.storage.local.set({
apiTextKey: document.querySelector("#apiTextKey").value
});
}
function restoreOptions() {
chrome.storage.local.get("apiEmojiKey", ({apiEmojiKey}) => {
document.querySelector("#apiEmojiKey").value = result.apiEmojiKey || "";
});
chrome.storage.local.get("apiTextKey", ({apiTextKey}) => {
document.querySelector("#apiTextKey").value = result.apiTextKey || "";
});
}
document.addEventListener("DOMContentLoaded", restoreOptions);
document.querySelector("form").addEventListener("submit", saveOptions);