1 | import { AnyActorLogic, EventFromLogic, InputFrom, SnapshotFrom } from "./types.js";
|
2 | /** @deprecated Use `initialTransition(…)` instead. */
|
3 | export declare function getInitialSnapshot<T extends AnyActorLogic>(actorLogic: T, ...[input]: undefined extends InputFrom<T> ? [input?: InputFrom<T>] : [input: InputFrom<T>]): SnapshotFrom<T>;
|
4 | /**
|
5 | * Determines the next snapshot for the given `actorLogic` based on the given
|
6 | * `snapshot` and `event`.
|
7 | *
|
8 | * If the `snapshot` is `undefined`, the initial snapshot of the `actorLogic` is
|
9 | * used.
|
10 | *
|
11 | * @deprecated Use `transition(…)` instead.
|
12 | * @example
|
13 | *
|
14 | * ```ts
|
15 | * import { getNextSnapshot } from 'xstate';
|
16 | * import { trafficLightMachine } from './trafficLightMachine.ts';
|
17 | *
|
18 | * const nextSnapshot = getNextSnapshot(
|
19 | * trafficLightMachine, // actor logic
|
20 | * undefined, // snapshot (or initial state if undefined)
|
21 | * { type: 'TIMER' }
|
22 | * ); // event object
|
23 | *
|
24 | * console.log(nextSnapshot.value);
|
25 | * // => 'yellow'
|
26 | *
|
27 | * const nextSnapshot2 = getNextSnapshot(
|
28 | * trafficLightMachine, // actor logic
|
29 | * nextSnapshot, // snapshot
|
30 | * { type: 'TIMER' }
|
31 | * ); // event object
|
32 | *
|
33 | * console.log(nextSnapshot2.value);
|
34 | * // =>'red'
|
35 | * ```
|
36 | */
|
37 | export declare function getNextSnapshot<T extends AnyActorLogic>(actorLogic: T, snapshot: SnapshotFrom<T>, event: EventFromLogic<T>): SnapshotFrom<T>;
|