Revert "add debouncing to selected theme"

This reverts commit ad7255efcc.
This commit is contained in:
SethBurkart123
2024-05-03 12:33:11 +10:00
parent ad7255efcc
commit be1679007e
3 changed files with 5 additions and 32 deletions
+4 -18
View File
@@ -1,5 +1,4 @@
import browser from 'webextension-polyfill'
import { debounce } from 'lodash';
import {
CreateBackground,
@@ -12,18 +11,13 @@ import {
} from '../../../SEQTA';
import { updateBgDurations } from '../../ui/Animation';
import { getDarkMode, updateAllColors } from '../../ui/colors/Manager';
//import { appendBackgroundToUI } from '../../ui/ImageBackgrounds';
import { setTheme } from '../../ui/themes/setTheme';
import { disableTheme } from '../../ui/themes/disableTheme';
import { appendBackgroundToUI } from '../../ui/ImageBackgrounds';
export default class StorageListener {
darkMode: any;
debouncedSetTheme: any;
constructor() {
this.darkMode = getDarkMode();
this.debouncedSetTheme = debounce(this.applyTheme, 300); // 300 ms debounce period
browser.storage.onChanged.addListener(this.handleStorageChanges.bind(this));
}
@@ -88,23 +82,15 @@ export default class StorageListener {
}
break;
case 'selectedTheme':
this.debouncedSetTheme(changes.selectedTheme.newValue);
case 'theme':
console.log(changes.theme.newValue)
break;
default:
break;
}
});
}
applyTheme(theme: string) {
if (theme === '') {
disableTheme();
} else {
setTheme(theme);
}
}
}
handleSelectedColorChange(newColor: any) {
try {