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 { useSyncExternalStore } from 'react' | |
| type CB<T> = (v: T) => void | |
| export type Atom<V> = { | |
| get: () => V | |
| set: (v: V | ((oldV: V) => V)) => V | |
| subscribe: (cb: CB<V>) => () => void | |
| } | |
| export function atom<AtomValue>(value: AtomValue): Atom<AtomValue> { | |
| const subscribers = new Set<(value: AtomValue) => void>() |
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
| JavaScript 1 hr 16 mins βββββββββββββββββββββ 97.3% | |
| TypeScript 2 mins βββββββββββββββββββββ 2.6% | |
| JSON 0 secs βββββββββββββββββββββ 0.0% |