Skip to content

Commit

Permalink
add INTERNAL_onInit api to atom
Browse files Browse the repository at this point in the history
  • Loading branch information
dmaskasky committed Dec 23, 2024
1 parent 7883c4e commit f57d740
Show file tree
Hide file tree
Showing 6 changed files with 560 additions and 85 deletions.
7 changes: 7 additions & 0 deletions src/vanilla/atom.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import type { AtomState, PrdOrDevStore as Store } from './store'

type Getter = <Value>(atom: Atom<Value>) => Value

type Setter = <Value, Args extends unknown[], Result>(
Expand Down Expand Up @@ -47,6 +49,11 @@ export interface Atom<Value> {
* @private
*/
debugPrivate?: boolean
/**
* Fires after atom is referenced by the store for the first time
* For internal use only and subject to change without notice.
*/
INTERNAL_onInit?: (store: Store, atomState: AtomState) => void
}

export interface WritableAtom<Value, Args extends unknown[], Result>
Expand Down
Loading

0 comments on commit f57d740

Please sign in to comment.