mirror of
https://github.com/littensy/charm.git
synced 2026-10-20 17:51:37 +00:00
refactor!: design overhaul (#1)
* refactor!: use atom functions * docs: reformat api reference * docs: showcase atom functions * docs: remove unused import * refactor: finalize updates * chore: misc edits
This commit is contained in:
parent
4d4979daa9
commit
33ecae2f50
39 changed files with 577 additions and 729 deletions
16
src/types.luau
Normal file
16
src/types.luau
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
export type WeakMap<K, V> = typeof(setmetatable({} :: { [K]: V }, { __mode = "k" }))
|
||||
|
||||
export type Atom<T> = (() -> T) & (state: T | (T) -> T) -> T
|
||||
|
||||
export type Source<T> = () -> T
|
||||
|
||||
export type AtomOptions<T> = {
|
||||
equals: (prev: T, next: T) -> boolean,
|
||||
}
|
||||
|
||||
export type SyncPayload = {
|
||||
type: "patch" | "set",
|
||||
data: { [any]: any },
|
||||
}
|
||||
|
||||
return nil
|
||||
Loading…
Add table
Add a link
Reference in a new issue