* Returns the initial `State` instance, with reference to `self` as an * `ActorRef`.
(
actorScope: ActorScope<
MachineSnapshot<
TContext,
TEvent,
TChildren,
TStateValue,
TTag,
TOutput,
TMeta,
TStateSchema
>,
TEvent,
AnyActorSystem,
TEmitted
>,
input?: TInput
)
| 412 | * `ActorRef`. |
| 413 | */ |
| 414 | public getInitialSnapshot( |
| 415 | actorScope: ActorScope< |
| 416 | MachineSnapshot< |
| 417 | TContext, |
| 418 | TEvent, |
| 419 | TChildren, |
| 420 | TStateValue, |
| 421 | TTag, |
| 422 | TOutput, |
| 423 | TMeta, |
| 424 | TStateSchema |
| 425 | >, |
| 426 | TEvent, |
| 427 | AnyActorSystem, |
| 428 | TEmitted |
| 429 | >, |
| 430 | input?: TInput |
| 431 | ): MachineSnapshot< |
| 432 | TContext, |
| 433 | TEvent, |
| 434 | TChildren, |
| 435 | TStateValue, |
| 436 | TTag, |
| 437 | TOutput, |
| 438 | TMeta, |
| 439 | TStateSchema |
| 440 | > { |
| 441 | const initEvent = createInitEvent(input) as unknown as TEvent; // TODO: fix; |
| 442 | const internalQueue: AnyEventObject[] = []; |
| 443 | const preInitialState = this._getPreInitialState( |
| 444 | actorScope, |
| 445 | initEvent, |
| 446 | internalQueue |
| 447 | ); |
| 448 | const [nextState] = initialMicrostep( |
| 449 | this.root, |
| 450 | preInitialState, |
| 451 | actorScope, |
| 452 | initEvent, |
| 453 | internalQueue |
| 454 | ); |
| 455 | |
| 456 | const { snapshot: macroState } = macrostep( |
| 457 | nextState, |
| 458 | initEvent as AnyEventObject, |
| 459 | actorScope, |
| 460 | internalQueue |
| 461 | ); |
| 462 | |
| 463 | return macroState as SnapshotFrom<this>; |
| 464 | } |
| 465 | |
| 466 | public start( |
| 467 | snapshot: MachineSnapshot< |
no test coverage detected