small-state-react 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +4 -1
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -40,8 +40,11 @@ npm i small-state-react
40
40
 
41
41
  #### `atomWithRuntimeSnapshot(machine, options?)`
42
42
 
43
- `<M extends AnyMachine>(machine: M | ((get:Getter)=>M), options?: RuntimeOptions<M>) => WritableAtom<Snapshot<M>, [event: SendFnEvent<M>], void>`
43
+ `<M extends AnyMachine>(machine: M | ((get:Getter)=>M), options?: RuntimeOptions<M> & { onPreStart?: (runtime: Runtime<M>) => void }) => WritableAtom<Snapshot<M>, [event: SendFnEvent<M>], void>`
44
+
44
45
 
45
46
  - Returns an atom for the specified machine.
46
47
  - It is initialized as a runtime and started when mounted somewhere. When it is no longer mounted anywhere, the runtime is destroyed.
47
48
  - The values returned when passed to `useAtom` are `[snapshot, send]`.
49
+ - The `onPreStart` option is a hook function that is called immediately before the runtime starts. It receives `runtime` as an argument.
50
+ - This is useful for registering `.onEmitted` or `.subscribe` handlers.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "small-state-react",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "React and Jotai bindings for small-state, a lightweight state machine library.",
5
5
  "author": "qyvvy",
6
6
  "license": "MIT",