MCPcopy
hub / github.com/statelyai/xstate / provide

Method provide

packages/core/src/StateMachine.ts:184–221  ·  view source on GitHub ↗

* Clones this state machine with the provided implementations. * * @param implementations Options (`actions`, `guards`, `actors`, `delays`) to * recursively merge with the existing options. * @returns A new `StateMachine` instance with the provided implementations.

(
    implementations: InternalMachineImplementations<
      ResolvedStateMachineTypes<
        TContext,
        DoNotInfer<TEvent>,
        TActor,
        TAction,
        TGuard,
        TDelay,
        TTag,
        TEmitted
      >
    >
  )

Source from the content-addressed store, hash-verified

182 * @returns A new `StateMachine` instance with the provided implementations.
183 */
184 public provide(
185 implementations: InternalMachineImplementations<
186 ResolvedStateMachineTypes<
187 TContext,
188 DoNotInfer<TEvent>,
189 TActor,
190 TAction,
191 TGuard,
192 TDelay,
193 TTag,
194 TEmitted
195 >
196 >
197 ): StateMachine<
198 TContext,
199 TEvent,
200 TChildren,
201 TActor,
202 TAction,
203 TGuard,
204 TDelay,
205 TStateValue,
206 TTag,
207 TInput,
208 TOutput,
209 TEmitted,
210 TMeta,
211 TStateSchema
212 > {
213 const { actions, guards, actors, delays } = this.implementations;
214
215 return new StateMachine(this.config, {
216 actions: { ...actions, ...implementations.actions },
217 guards: { ...guards, ...implementations.guards },
218 actors: { ...actors, ...implementations.actors },
219 delays: { ...delays, ...implementations.delays }
220 });
221 }
222
223 public resolveState(
224 config: {

Callers 15

useActor.test.tsFile · 0.80
actions.test.tsFile · 0.80
actorLogic.test.tsFile · 0.80
spawnChild.test.tsFile · 0.80
machine.test.tsFile · 0.80
invoke.test.tsFile · 0.80
useActor.test.tsxFile · 0.80
FetcherFunction · 0.80
ComponentFunction · 0.80
ToggleFunction · 0.80
AppFunction · 0.80

Calls

no outgoing calls

Tested by 10

FetcherFunction · 0.64
ComponentFunction · 0.64
ToggleFunction · 0.64
AppFunction · 0.64
AppFunction · 0.64
AppFunction · 0.64
TestFunction · 0.64
FetcherFunction · 0.64
ToggleFunction · 0.64
AppFunction · 0.64