Commit 7f12f0c 1 parent 3f3e3f4 commit 7f12f0c Copy full SHA for 7f12f0c
File tree 2 files changed +35
-0
lines changed
2 files changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -18,4 +18,21 @@ const content = "hi!";
18
18
document.querySelector('h1')?.addEventListener('click', () => {
19
19
logger('clicked');
20
20
});
21
+
22
+ function someFunction() {
23
+ const theme = (() => {
24
+ if (
25
+ typeof localStorage !== 'undefined' && localStorage.getItem('theme')
26
+ ) {
27
+ return localStorage.getItem('theme')
28
+ }
29
+ })()
30
+ if (theme === 'light') {
31
+ document.documentElement.classList.remove('dark')
32
+ } else {
33
+ document.documentElement.classList.add('dark')
34
+ }
35
+ return
36
+ }
37
+ someFunction()
21
38
</script >
Original file line number Diff line number Diff line change @@ -18,4 +18,22 @@ const { log: logger } = console
18
18
document.querySelector('h1')?.addEventListener('click', () => {
19
19
logger('clicked')
20
20
})
21
+
22
+ function someFunction() {
23
+ const theme = (() => {
24
+ if (
25
+ typeof localStorage !== 'undefined'
26
+ && localStorage.getItem('theme')
27
+ ) {
28
+ return localStorage.getItem('theme')
29
+ }
30
+ })()
31
+ if (theme === 'light') {
32
+ document.documentElement.classList.remove('dark')
33
+ }
34
+ else {
35
+ document.documentElement.classList.add('dark')
36
+ }
37
+ }
38
+ someFunction()
21
39
</script >
You can’t perform that action at this time.
0 commit comments