forked from nanostores/nanostores
-
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.
+ autosubscribe,Autosubscribe,autosubscriber,BoxAutosubscribe,UnboxAu…
…tosubscribe (nanostores#188) atom: is a function which takes an optional autosubscribe function & returns .get() + .a: active autosubscribe when atom was instantiated computed: + autosubscribe: (): returns computed store's value (store: AnyStore): computed store autosubscribes to the given store (cb: () => any): runs the cb & autosubscribes to any called store functions within the cb .off(cb): hook which runs callback onUnmount & before the computed cb being called .on(cb): hook which runs callback onMount .save(): sets computed & sets undoValue .set(newValue): sets computed & does not set undoValue .stale(): returns true if computed store's cb was called again after call associated with the autosubscribe .undo: sets computed to undoValue a stale autosubscribe has some of it's methods neutered: .off .on .save .set .undo + async support Thanks to @dtinth for autosubscribe function type inference which he implemented in https://github.com/dtinth/nanostores-computed-dynamic size-limit: Atom: - 4 B All: + 288 B
- Loading branch information
Showing
11 changed files
with
1,655 additions
and
158 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
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
Oops, something went wrong.