-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f7db33b
commit 09af3e6
Showing
9 changed files
with
52 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,40 @@ | ||
# Squarkdown Docs | ||
<!-- #SQUARK live! | ||
| dest = docs | ||
--> | ||
|
||
> [!Note] | ||
> Under construction! | ||
Welcome to the *Squarkdown* docs, where you can find all you need to know about Squarkdown! | ||
|
||
```js | ||
/** | ||
* A $state() rune persisted to `localStorage`. | ||
*/ | ||
export class PersistedState<T> | ||
{ | ||
#key: string; | ||
value = $state<T>() as T; | ||
|
||
get key() { | ||
return this.#key; | ||
} | ||
|
||
constructor(key: string, init: T) | ||
{ | ||
this.#key = key ?? ""; | ||
this.value = init; | ||
|
||
if (browser) { | ||
let data = localStorage.getItem(this.key); | ||
if (data) { | ||
this.value = JSON.parse(data); | ||
} | ||
} | ||
|
||
$effect.root(() => { | ||
$effect(() => { | ||
localStorage?.setItem(this.key, JSON.stringify(this.value)); | ||
}) | ||
}); | ||
} | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# Cleanup | ||
<!-- #SQUARK live! | ||
<!-- #SQUARK dead! | ||
| dest = squarkup/cleanup | ||
--> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
# output | ||
build/ | ||
static/ | ||
(docs)/ | ||
|
||
# internal | ||
node_modules/ | ||
|