This file contains hidden or 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
| search = { | |
| pattern = [[(?:\/\/|--(\[\[)?|\*|#\|?|%\{?|;|\{-)[\t ]*(?:(KEYWORDS):)]], | |
| --[[ | |
| Regex explanation: | |
| 1. (?:...) - non-capture group for comment tokens: | |
| \/\/ - matches // , used in lots of languages | |
| --(\[\[)? - matches -- and --[[ , -- used in SQL, Haskell, Lua, | |
| Ada, AppleScript, VHDL, --[[ used in Lua multiline, also | |
| matches <!-- for HTML, XML, Markdown | |
| \* - matches various formats ( /* /** (* ), lines starting |
This file contains hidden or 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
| import { browser } from '$app/environment' | |
| export type PersistentStore<T> = ReturnType<typeof newPersistentStore<T>> | |
| export function newPersistentStore<T>(key: string, initial: T) { | |
| let value = $state<T>(initial) | |
| let mounted = $state(false) | |
| const storeName = `Persistent store '${key}'` | |
| function mount() { |