#48 Added types for settings scripts
This commit is contained in:
parent
36b12f5397
commit
a743cc9897
|
@ -5,25 +5,28 @@ const OPTION_SELECTOR = 'input[type="checkbox"';
|
||||||
|
|
||||||
function storeOptions() {
|
function storeOptions() {
|
||||||
document.querySelectorAll(OPTION_SELECTOR).forEach(optionElement => {
|
document.querySelectorAll(OPTION_SELECTOR).forEach(optionElement => {
|
||||||
getGlobalStorageProvider().setDataAsBoolean(optionElement.id, optionElement.checked);
|
let optionInputElement = optionElement as HTMLInputElement;
|
||||||
|
getGlobalStorageProvider().setDataAsBoolean(optionInputElement.id, optionInputElement.checked);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function restoreOptions() {
|
function restoreOptions() {
|
||||||
document.querySelectorAll(OPTION_SELECTOR).forEach(optionElement => {
|
document.querySelectorAll(OPTION_SELECTOR).forEach(optionElement => {
|
||||||
let defaultValue = optionElement.dataset.defaultValue === 'true' ? true : false;
|
let optionInputElement = optionElement as HTMLInputElement;
|
||||||
|
let defaultValue = optionInputElement.dataset.defaultValue === 'true' ? true : false;
|
||||||
|
|
||||||
getGlobalStorageProvider().getDataAsBoolean(optionElement.id, defaultValue, value => {
|
getGlobalStorageProvider().getDataAsBoolean(optionInputElement.id, defaultValue, value => {
|
||||||
optionElement.checked = value;
|
optionInputElement.checked = value;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function resetOptions() {
|
function resetOptions() {
|
||||||
document.querySelectorAll(OPTION_SELECTOR).forEach(optionElement => {
|
document.querySelectorAll(OPTION_SELECTOR).forEach(optionElement => {
|
||||||
let defaultValue = optionElement.dataset.defaultValue === 'true' ? true : false;
|
let optionInputElement = optionElement as HTMLInputElement;
|
||||||
|
let defaultValue = optionInputElement.dataset.defaultValue === 'true' ? true : false;
|
||||||
|
|
||||||
optionElement.checked = defaultValue;
|
optionInputElement.checked = defaultValue;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue