@xmachines/docs 3.0.0 → 4.0.0
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.
- package/README.md +8 -16
- package/api/@xmachines/play/README.md +11 -100
- package/api/@xmachines/play/errors/README.md +8 -0
- package/api/@xmachines/play/{classes → errors/classes}/NonNullableError.md +6 -6
- package/api/@xmachines/play/{classes → errors/classes}/PlayError.md +35 -10
- package/api/@xmachines/play/index/README.md +75 -0
- package/api/@xmachines/play/{functions → index/functions}/asCleanup.md +2 -2
- package/api/@xmachines/play/{functions → index/functions}/assertNonNullable.md +2 -2
- package/api/@xmachines/{play-actor → play/index}/functions/shallowEqualExcept.md +3 -3
- package/api/@xmachines/play/{type-aliases → index/type-aliases}/Cleanup.md +3 -3
- package/api/@xmachines/play/{type-aliases → index/type-aliases}/DisposeKey.md +2 -2
- package/api/@xmachines/play/{type-aliases → index/type-aliases}/PlayEvent.md +4 -4
- package/api/@xmachines/play/{variables → index/variables}/DISPOSE.md +2 -2
- package/api/@xmachines/play-actor/README.md +78 -229
- package/api/@xmachines/play-actor/interfaces/ActorEvent.md +18 -0
- package/api/@xmachines/play-actor/interfaces/PlayActor.md +73 -0
- package/api/@xmachines/play-dom/README.md +28 -40
- package/api/@xmachines/play-dom/classes/PlayRenderer.md +12 -11
- package/api/@xmachines/play-dom/functions/asCleanup.md +78 -0
- package/api/@xmachines/play-dom/functions/createPlayUI.md +4 -4
- package/api/@xmachines/play-dom/functions/createRenderer.md +1 -1
- package/api/@xmachines/play-dom/interfaces/CreatePlayUIOptions.md +3 -3
- package/api/@xmachines/play-dom/interfaces/MountOptions.md +3 -3
- package/api/@xmachines/play-dom/interfaces/PlayDomOptions.md +6 -6
- package/api/@xmachines/play-dom/type-aliases/Cleanup.md +2 -2
- package/api/@xmachines/play-dom/type-aliases/MountFn.md +29 -12
- package/api/@xmachines/play-dom-router/README.md +70 -70
- package/api/@xmachines/play-dom-router/classes/DomRouterBridge.md +22 -21
- package/api/@xmachines/{play-vue-router → play-dom-router}/classes/RouteMap.md +12 -6
- package/api/@xmachines/play-dom-router/functions/asCleanup.md +78 -0
- package/api/@xmachines/play-dom-router/functions/connectRouter.md +3 -8
- package/api/@xmachines/play-dom-router/functions/createBrowserHistory.md +9 -3
- package/api/@xmachines/play-dom-router/functions/createRouter.md +8 -14
- package/api/@xmachines/play-dom-router/interfaces/BasePathOptions.md +5 -5
- package/api/@xmachines/play-dom-router/interfaces/BrowserHistory.md +70 -26
- package/api/@xmachines/play-dom-router/interfaces/BrowserWindow.md +14 -14
- package/api/@xmachines/play-dom-router/interfaces/ConnectRouterOptions.md +8 -8
- package/api/@xmachines/play-dom-router/interfaces/PlayRouteEvent.md +9 -14
- package/api/@xmachines/play-dom-router/interfaces/RoutableActor.md +24 -21
- package/api/@xmachines/play-dom-router/interfaces/RouteLookupContract.md +3 -3
- package/api/@xmachines/play-dom-router/interfaces/RouteMapOptions.md +4 -4
- package/api/@xmachines/play-dom-router/interfaces/RouteMapping.md +3 -3
- package/api/@xmachines/play-dom-router/interfaces/RouterBridge.md +3 -3
- package/api/@xmachines/play-dom-router/interfaces/RouterConnection.md +8 -8
- package/api/@xmachines/play-dom-router/interfaces/VanillaRouter.md +36 -23
- package/api/@xmachines/play-dom-router/type-aliases/Cleanup.md +2 -2
- package/api/@xmachines/play-dom-router/variables/DISPOSE.md +2 -2
- package/api/@xmachines/play-react/README.md +17 -39
- package/api/@xmachines/play-react/classes/PlayErrorBoundary.md +14 -10
- package/api/@xmachines/play-react/functions/useActor.md +1 -1
- package/api/@xmachines/play-react/functions/usePlayView.md +1 -1
- package/api/@xmachines/play-react/functions/useSignalEffect.md +1 -1
- package/api/@xmachines/play-react/interfaces/ActorProviderProps.md +11 -11
- package/api/@xmachines/play-react/interfaces/PlayErrorBoundaryProps.md +6 -6
- package/api/@xmachines/play-react/interfaces/PlayErrorBoundaryState.md +4 -4
- package/api/@xmachines/play-react/interfaces/PlayUIProviderProps.md +13 -13
- package/api/@xmachines/play-react/interfaces/ViewContextValue.md +8 -8
- package/api/@xmachines/play-react/type-aliases/AnyPlayActor.md +11 -3
- package/api/@xmachines/play-react/variables/ActorProvider.md +1 -1
- package/api/@xmachines/play-react/variables/PlayRenderer.md +1 -1
- package/api/@xmachines/play-react/variables/PlayUIProvider.md +1 -1
- package/api/@xmachines/play-react/variables/schema.md +52 -0
- package/api/@xmachines/play-react-router/README.md +22 -50
- package/api/@xmachines/play-react-router/classes/ReactRouterBridge.md +17 -16
- package/api/@xmachines/play-react-router/classes/RouteMap.md +11 -5
- package/api/@xmachines/play-react-router/functions/createPlayRouterProvider.md +11 -8
- package/api/@xmachines/play-react-router/functions/createRouteMapFromTree.md +16 -9
- package/api/@xmachines/play-react-router/interfaces/PlayRouteEvent.md +9 -14
- package/api/@xmachines/play-react-router/interfaces/PlayRouterProviderProps.md +10 -10
- package/api/@xmachines/play-react-router/interfaces/RoutableActor.md +72 -0
- package/api/@xmachines/play-react-router/interfaces/RouteMapOptions.md +4 -4
- package/api/@xmachines/play-react-router/interfaces/RouteMapping.md +3 -3
- package/api/@xmachines/play-react-router/interfaces/RouterBridge.md +3 -3
- package/api/@xmachines/play-react-router/type-aliases/PlayRouterBridgeConstructor.md +17 -7
- package/api/@xmachines/play-react-router/type-aliases/PlayRouterProviderBaseProps.md +5 -5
- package/api/@xmachines/play-react-router/variables/PlayRouterProvider.md +4 -4
- package/api/@xmachines/play-router/README.md +104 -196
- package/api/@xmachines/play-router/errors/README.md +15 -0
- package/api/@xmachines/play-router/errors/classes/DuplicateBridgeError.md +191 -0
- package/api/@xmachines/play-router/errors/classes/DuplicateRoutePathError.md +175 -0
- package/api/@xmachines/play-router/errors/classes/EmptyRoutePathError.md +175 -0
- package/api/@xmachines/play-router/errors/classes/InvalidBasePathError.md +200 -0
- package/api/@xmachines/play-router/errors/classes/InvalidRoutePatternError.md +203 -0
- package/api/@xmachines/play-router/errors/classes/InvalidStateIdError.md +175 -0
- package/api/@xmachines/play-router/errors/classes/MissingBasePathParamError.md +199 -0
- package/api/@xmachines/play-router/errors/classes/RouterSyncError.md +192 -0
- package/api/@xmachines/play-router/errors/classes/UnknownStateTypeError.md +182 -0
- package/api/@xmachines/play-router/index/README.md +75 -0
- package/api/@xmachines/play-router/{classes → index/classes}/RouteMap.md +12 -6
- package/api/@xmachines/play-router/{classes → index/classes}/RouterBridgeBase.md +19 -17
- package/api/@xmachines/play-router/{functions → index/functions}/buildPlayRouteEvent.md +2 -2
- package/api/@xmachines/play-router/{functions → index/functions}/buildRouteTree.md +14 -4
- package/api/@xmachines/play-router/{functions → index/functions}/cleanFrameworkParams.md +3 -4
- package/api/@xmachines/play-router/{functions → index/functions}/createRouteMapFromTree.md +13 -6
- package/api/@xmachines/play-router/{functions → index/functions}/createRouterConnection.md +2 -2
- package/api/@xmachines/play-router/{functions → index/functions}/detectDuplicateRoutes.md +2 -2
- package/api/@xmachines/play-router/{functions → index/functions}/extractQuery.md +2 -2
- package/api/@xmachines/play-router/{functions → index/functions}/extractRouteParams.md +3 -3
- package/api/@xmachines/play-router/{functions → index/functions}/findRouteById.md +2 -2
- package/api/@xmachines/play-router/{functions → index/functions}/findRouteByPath.md +2 -2
- package/api/@xmachines/play-router/index/functions/getPatternParamNames.md +29 -0
- package/api/@xmachines/play-router/index/functions/getRequiredPatternParamNames.md +39 -0
- package/api/@xmachines/play-router/{functions → index/functions}/isMountableBridge.md +2 -2
- package/api/@xmachines/play-router/index/functions/joinBasePath.md +37 -0
- package/api/@xmachines/play-router/{functions → index/functions}/mountKey.md +2 -2
- package/api/@xmachines/play-router/index/functions/normalizeBasePath.md +43 -0
- package/api/@xmachines/play-router/{functions → index/functions}/openProviderBridge.md +14 -14
- package/api/@xmachines/play-router/index/functions/pickOwnParams.md +41 -0
- package/api/@xmachines/play-router/{functions → index/functions}/repointProviderBridge.md +2 -2
- package/api/@xmachines/play-router/index/functions/resolveBasePath.md +51 -0
- package/api/@xmachines/play-router/{functions → index/functions}/resolveFrameworkParams.md +11 -13
- package/api/@xmachines/play-router/{functions → index/functions}/sanitizePathname.md +2 -2
- package/api/@xmachines/play-router/index/functions/stripBasePath.md +44 -0
- package/api/@xmachines/play-router/{functions → index/functions}/validateRouteFormat.md +2 -2
- package/api/@xmachines/play-router/{functions → index/functions}/validateStateExists.md +2 -2
- package/api/@xmachines/play-router/{interfaces → index/interfaces}/BasePathOptions.md +6 -6
- package/api/@xmachines/play-router/index/interfaces/BuildPlayRouteEventOptions.md +13 -0
- package/api/@xmachines/play-router/index/interfaces/FrameworkParamsSource.md +47 -0
- package/api/@xmachines/play-router/{interfaces → index/interfaces}/LocationLike.md +6 -6
- package/api/@xmachines/play-router/{interfaces → index/interfaces}/MountableRouterBridge.md +9 -9
- package/api/@xmachines/play-router/{interfaces → index/interfaces}/OpenProviderBridgeArgs.md +13 -13
- package/api/@xmachines/play-router/index/interfaces/PlayRouteEvent.md +130 -0
- package/api/@xmachines/play-router/{interfaces → index/interfaces}/PlayRouterProviderBaseProps.md +15 -15
- package/api/@xmachines/play-router/index/interfaces/ResolvedBasePath.md +14 -0
- package/api/@xmachines/play-router/{interfaces → index/interfaces}/ResolvedRoutePath.md +6 -6
- package/api/@xmachines/play-router/index/interfaces/Routable.md +26 -0
- package/api/@xmachines/play-router/index/interfaces/RoutableActor.md +72 -0
- package/api/@xmachines/play-router/{interfaces → index/interfaces}/RouteInfo.md +11 -11
- package/api/@xmachines/play-router/{interfaces → index/interfaces}/RouteMapOptions.md +5 -5
- package/api/@xmachines/play-router/{interfaces → index/interfaces}/RouteMapping.md +6 -6
- package/api/@xmachines/play-router/index/interfaces/RouteMatch.md +12 -0
- package/api/@xmachines/play-router/{interfaces → index/interfaces}/RouteNode.md +13 -13
- package/api/@xmachines/play-router/index/interfaces/RouteObject.md +34 -0
- package/api/@xmachines/play-router/index/interfaces/RouteTree.md +27 -0
- package/api/@xmachines/play-router/{interfaces → index/interfaces}/RouteWatcherHandle.md +7 -7
- package/api/@xmachines/play-router/{interfaces → index/interfaces}/RouterBridge.md +5 -5
- package/api/@xmachines/play-router/{interfaces → index/interfaces}/RouterConnection.md +10 -10
- package/api/@xmachines/play-router/{interfaces → index/interfaces}/WindowLike.md +4 -4
- package/api/@xmachines/play-router/index/type-aliases/PlayRouterBridgeConstructor.md +46 -0
- package/api/@xmachines/play-router/index/type-aliases/RouteData.md +12 -0
- package/api/@xmachines/play-router/index/type-aliases/RouteDataResolver.md +31 -0
- package/api/@xmachines/play-router/index/type-aliases/RouteMetadata.md +11 -0
- package/api/@xmachines/{play-xstate → play-router/index}/variables/DISPOSE.md +3 -3
- package/api/@xmachines/play-router/index/variables/NO_BASE_PATH.md +18 -0
- package/api/@xmachines/play-router/index/variables/ROOT_NODE_ID.md +18 -0
- package/api/@xmachines/play-router/xstate/README.md +53 -0
- package/api/@xmachines/play-router/{functions → xstate/functions}/createRouteMap.md +8 -6
- package/api/@xmachines/play-router/{functions → xstate/functions}/extractMachineRoutes.md +4 -4
- package/api/@xmachines/play-router/xstate/functions/getNavigableRoutes.md +35 -0
- package/api/@xmachines/play-router/{functions → xstate/functions}/getRoutableRoutes.md +6 -6
- package/api/@xmachines/play-router/{functions → xstate/functions}/getRouteMappings.md +7 -7
- package/api/@xmachines/play-router/{functions → xstate/functions}/getTransitionReachableRoutes.md +2 -2
- package/api/@xmachines/play-router/{functions → xstate/functions}/isRouteReachable.md +2 -2
- package/api/@xmachines/play-router/{functions → xstate/functions}/machineToGraph.md +2 -2
- package/api/@xmachines/play-router/xstate/functions/routeExists.md +26 -0
- package/api/@xmachines/play-router/xstate/interfaces/MachineEdgeData.md +15 -0
- package/api/@xmachines/play-router/xstate/interfaces/MachineNodeData.md +17 -0
- package/api/@xmachines/play-router/{type-aliases → xstate/type-aliases}/MachineGraph.md +2 -2
- package/api/@xmachines/play-signals/README.md +2 -24
- package/api/@xmachines/play-signals/functions/watchSignal.md +1 -1
- package/api/@xmachines/play-signals/interfaces/ComputedOptions.md +2 -2
- package/api/@xmachines/play-signals/interfaces/SignalComputed.md +2 -2
- package/api/@xmachines/play-signals/interfaces/SignalOptions.md +2 -2
- package/api/@xmachines/play-signals/interfaces/SignalState.md +3 -3
- package/api/@xmachines/play-signals/interfaces/SignalWatcher.md +4 -4
- package/api/@xmachines/play-signals/type-aliases/Cleanup.md +2 -2
- package/api/@xmachines/play-signals/type-aliases/WatcherNotify.md +1 -1
- package/api/@xmachines/play-solid/README.md +14 -31
- package/api/@xmachines/play-solid/functions/useActor.md +1 -1
- package/api/@xmachines/play-solid/functions/usePlayView.md +1 -1
- package/api/@xmachines/play-solid/interfaces/ActorProviderProps.md +11 -11
- package/api/@xmachines/play-solid/interfaces/PlayUIProviderProps.md +13 -13
- package/api/@xmachines/play-solid/interfaces/ViewContextValue.md +8 -8
- package/api/@xmachines/play-solid/type-aliases/AnyPlayActor.md +11 -3
- package/api/@xmachines/play-solid/variables/ActorContext.md +1 -1
- package/api/@xmachines/play-solid/variables/ActorProvider.md +1 -1
- package/api/@xmachines/play-solid/variables/PlayRenderer.md +1 -1
- package/api/@xmachines/play-solid/variables/PlayUIProvider.md +1 -1
- package/api/@xmachines/play-solid/variables/schema.md +71 -0
- package/api/@xmachines/play-solid-router/README.md +31 -52
- package/api/@xmachines/play-solid-router/classes/RouteMap.md +11 -5
- package/api/@xmachines/play-solid-router/classes/SolidRouterBridge.md +30 -53
- package/api/@xmachines/play-solid-router/functions/createPlayRouterProvider.md +9 -8
- package/api/@xmachines/play-solid-router/interfaces/PlayActor.md +38 -35
- package/api/@xmachines/play-solid-router/interfaces/PlayRouteEvent.md +9 -14
- package/api/@xmachines/play-solid-router/interfaces/PlayRouterProviderProps.md +12 -12
- package/api/@xmachines/play-solid-router/interfaces/RoutableActor.md +72 -0
- package/api/@xmachines/play-solid-router/interfaces/RouteMapOptions.md +4 -4
- package/api/@xmachines/play-solid-router/interfaces/RouteMapping.md +5 -5
- package/api/@xmachines/play-solid-router/interfaces/RouterBridge.md +3 -3
- package/api/@xmachines/play-solid-router/type-aliases/PlayRouterBridgeConstructor.md +17 -7
- package/api/@xmachines/play-solid-router/type-aliases/PlayRouterProviderBaseProps.md +5 -5
- package/api/@xmachines/play-solid-router/type-aliases/SolidRouterHooks.md +4 -4
- package/api/@xmachines/play-solid-router/variables/PlayRouterProvider.md +4 -4
- package/api/@xmachines/play-svelte/README.md +11 -26
- package/api/@xmachines/play-svelte/functions/defineRegistry.md +1 -1
- package/api/@xmachines/play-svelte/functions/getActorContext.md +1 -1
- package/api/@xmachines/play-svelte/functions/getPlayViewContext.md +1 -1
- package/api/@xmachines/play-svelte/functions/setActorContext.md +1 -1
- package/api/@xmachines/play-svelte/interfaces/ActorProviderProps.md +12 -12
- package/api/@xmachines/play-svelte/interfaces/DefineRegistryOptions.md +4 -4
- package/api/@xmachines/play-svelte/interfaces/PlayUIProviderProps.md +14 -14
- package/api/@xmachines/play-svelte/interfaces/ViewContextValue.md +8 -8
- package/api/@xmachines/play-svelte/type-aliases/AnyPlayActor.md +11 -3
- package/api/@xmachines/play-svelte/variables/schema.md +16 -0
- package/api/@xmachines/play-svelte-spa-router/README.md +22 -41
- package/api/@xmachines/play-svelte-spa-router/classes/RouteMap.md +11 -5
- package/api/@xmachines/play-svelte-spa-router/classes/SvelteSpaRouterBridge.md +22 -21
- package/api/@xmachines/play-svelte-spa-router/functions/connectRouter.md +3 -2
- package/api/@xmachines/play-svelte-spa-router/interfaces/BasePathOptions.md +5 -5
- package/api/@xmachines/play-svelte-spa-router/interfaces/ConnectRouterOptions.md +8 -8
- package/api/@xmachines/play-svelte-spa-router/interfaces/PlayRouteEvent.md +9 -14
- package/api/@xmachines/play-svelte-spa-router/interfaces/RoutableActor.md +72 -0
- package/api/@xmachines/play-svelte-spa-router/interfaces/RouteMapOptions.md +4 -4
- package/api/@xmachines/play-svelte-spa-router/interfaces/RouteMapping.md +3 -3
- package/api/@xmachines/play-svelte-spa-router/interfaces/RouterBridge.md +3 -3
- package/api/@xmachines/play-svelte-spa-router/interfaces/RouterConnection.md +8 -8
- package/api/@xmachines/play-svelte-spa-router/interfaces/WindowLike.md +3 -3
- package/api/@xmachines/play-sveltekit-router/README.md +17 -35
- package/api/@xmachines/play-sveltekit-router/classes/RouteMap.md +11 -5
- package/api/@xmachines/play-sveltekit-router/classes/SvelteKitRouterBridge.md +22 -21
- package/api/@xmachines/play-sveltekit-router/functions/connectRouter.md +3 -2
- package/api/@xmachines/play-sveltekit-router/interfaces/BasePathOptions.md +5 -5
- package/api/@xmachines/play-sveltekit-router/interfaces/ConnectRouterOptions.md +8 -8
- package/api/@xmachines/play-sveltekit-router/interfaces/LocationLike.md +3 -3
- package/api/@xmachines/play-sveltekit-router/interfaces/PlayRouteEvent.md +9 -14
- package/api/@xmachines/play-sveltekit-router/interfaces/RoutableActor.md +72 -0
- package/api/@xmachines/play-sveltekit-router/interfaces/RouteMapOptions.md +4 -4
- package/api/@xmachines/play-sveltekit-router/interfaces/RouteMapping.md +3 -3
- package/api/@xmachines/play-sveltekit-router/interfaces/RouterBridge.md +3 -3
- package/api/@xmachines/play-sveltekit-router/interfaces/RouterConnection.md +8 -8
- package/api/@xmachines/play-tanstack-react-router/README.md +19 -43
- package/api/@xmachines/play-tanstack-react-router/classes/RouteMap.md +11 -5
- package/api/@xmachines/play-tanstack-react-router/classes/TanStackReactRouterBridge.md +18 -17
- package/api/@xmachines/play-tanstack-react-router/functions/createPlayRouterProvider.md +11 -8
- package/api/@xmachines/play-tanstack-react-router/functions/createRouteMapFromTree.md +16 -9
- package/api/@xmachines/play-tanstack-react-router/interfaces/PlayRouteEvent.md +9 -14
- package/api/@xmachines/play-tanstack-react-router/interfaces/PlayRouterProviderProps.md +10 -10
- package/api/@xmachines/play-tanstack-react-router/interfaces/RoutableActor.md +72 -0
- package/api/@xmachines/play-tanstack-react-router/interfaces/RouteMapOptions.md +4 -4
- package/api/@xmachines/play-tanstack-react-router/interfaces/RouteMapping.md +3 -3
- package/api/@xmachines/play-tanstack-react-router/interfaces/RouterBridge.md +3 -3
- package/api/@xmachines/play-tanstack-react-router/type-aliases/PlayRouterBridgeConstructor.md +17 -7
- package/api/@xmachines/play-tanstack-react-router/type-aliases/PlayRouterProviderBaseProps.md +5 -5
- package/api/@xmachines/play-tanstack-react-router/type-aliases/TanStackRouterInstance.md +1 -1
- package/api/@xmachines/play-tanstack-react-router/type-aliases/TanStackRouterLike.md +5 -5
- package/api/@xmachines/play-tanstack-react-router/variables/PlayRouterProvider.md +4 -4
- package/api/@xmachines/play-tanstack-router/README.md +6 -4
- package/api/@xmachines/play-tanstack-router/classes/TanStackRouterBridgeBase.md +17 -20
- package/api/@xmachines/play-tanstack-router/type-aliases/TanStackRouteMapLike.md +3 -3
- package/api/@xmachines/play-tanstack-router/type-aliases/TanStackRouterLike.md +5 -5
- package/api/@xmachines/play-tanstack-solid-router/README.md +26 -52
- package/api/@xmachines/play-tanstack-solid-router/classes/RouteMap.md +11 -5
- package/api/@xmachines/play-tanstack-solid-router/classes/TanStackSolidRouterBridge.md +49 -45
- package/api/@xmachines/play-tanstack-solid-router/functions/createPlayRouterProvider.md +9 -8
- package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayRouteEvent.md +9 -14
- package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayRouterProviderProps.md +10 -10
- package/api/@xmachines/play-tanstack-solid-router/interfaces/RoutableActor.md +72 -0
- package/api/@xmachines/play-tanstack-solid-router/interfaces/RouteMapOptions.md +4 -4
- package/api/@xmachines/play-tanstack-solid-router/interfaces/RouteMapping.md +3 -3
- package/api/@xmachines/play-tanstack-solid-router/interfaces/RouterBridge.md +3 -3
- package/api/@xmachines/play-tanstack-solid-router/type-aliases/PlayRouterBridgeConstructor.md +17 -7
- package/api/@xmachines/play-tanstack-solid-router/type-aliases/PlayRouterProviderBaseProps.md +5 -5
- package/api/@xmachines/play-tanstack-solid-router/type-aliases/TanStackRouterInstance.md +1 -1
- package/api/@xmachines/play-tanstack-solid-router/type-aliases/TanStackRouterLike.md +5 -5
- package/api/@xmachines/play-tanstack-solid-router/variables/PlayRouterProvider.md +4 -4
- package/api/@xmachines/play-url/README.md +69 -0
- package/api/@xmachines/play-url/errors/README.md +17 -0
- package/api/@xmachines/play-url/errors/classes/InvalidBasePathError.md +200 -0
- package/api/@xmachines/play-url/errors/classes/InvalidRoutePatternError.md +203 -0
- package/api/@xmachines/play-url/errors/classes/MissingBasePathParamError.md +199 -0
- package/api/@xmachines/play-url/index/README.md +65 -0
- package/api/@xmachines/play-url/index/functions/cleanFrameworkParams.md +39 -0
- package/api/@xmachines/play-url/index/functions/getCandidates.md +29 -0
- package/api/@xmachines/play-url/index/functions/getCompiledPattern.md +31 -0
- package/api/@xmachines/play-url/index/functions/getIndexKey.md +30 -0
- package/api/@xmachines/play-url/index/functions/getNormalizedParamNameMap.md +32 -0
- package/api/@xmachines/play-url/index/functions/getPatternParamNames.md +29 -0
- package/api/@xmachines/play-url/index/functions/getRequiredPatternParamNames.md +39 -0
- package/api/@xmachines/play-url/index/functions/holdsUnsubstitutedParam.md +36 -0
- package/api/@xmachines/play-url/index/functions/isParameterizedPattern.md +36 -0
- package/api/@xmachines/{play-router → play-url/index}/functions/joinBasePath.md +2 -2
- package/api/@xmachines/{play-router → play-url/index}/functions/normalizeBasePath.md +2 -2
- package/api/@xmachines/play-url/index/functions/normalizeParamNames.md +36 -0
- package/api/@xmachines/play-url/index/functions/parsePattern.md +27 -0
- package/api/@xmachines/{play-router → play-url/index}/functions/pickOwnParams.md +4 -4
- package/api/@xmachines/{play-router → play-url/index}/functions/resolveBasePath.md +2 -2
- package/api/@xmachines/play-url/index/functions/resolveFrameworkParams.md +49 -0
- package/api/@xmachines/{play-router → play-url/index}/functions/stripBasePath.md +2 -2
- package/api/@xmachines/play-url/index/interfaces/BasePathOptions.md +28 -0
- package/api/@xmachines/{play-router → play-url/index}/interfaces/FrameworkParamsSource.md +9 -9
- package/api/@xmachines/play-url/index/interfaces/GroupPart.md +15 -0
- package/api/@xmachines/play-url/index/interfaces/LiteralPart.md +14 -0
- package/api/@xmachines/play-url/index/interfaces/ParamPart.md +21 -0
- package/api/@xmachines/play-url/index/interfaces/ParsedPattern.md +23 -0
- package/api/@xmachines/play-url/index/interfaces/PatternParam.md +15 -0
- package/api/@xmachines/{play-router → play-url/index}/interfaces/ResolvedBasePath.md +6 -6
- package/api/@xmachines/play-url/index/type-aliases/PatternModifier.md +11 -0
- package/api/@xmachines/play-url/index/type-aliases/PatternPart.md +9 -0
- package/api/@xmachines/play-url/index/type-aliases/URLPatternCtor.md +22 -0
- package/api/@xmachines/play-url/index/type-aliases/URLPatternLike.md +68 -0
- package/api/@xmachines/{play-router → play-url/index}/variables/NO_BASE_PATH.md +2 -2
- package/api/@xmachines/play-url/index/variables/URLPattern.md +21 -0
- package/api/@xmachines/play-view/README.md +165 -0
- package/api/@xmachines/play-view/errors/README.md +17 -0
- package/api/@xmachines/play-view/errors/classes/ReadOnlyContextError.md +192 -0
- package/api/@xmachines/play-view/index/README.md +55 -0
- package/api/@xmachines/{play-actor → play-view/index}/functions/attachRenderErrorHandler.md +6 -6
- package/api/@xmachines/{play-actor → play-view/index}/functions/composePlayState.md +2 -2
- package/api/@xmachines/{play-actor → play-view/index}/functions/createFailureLatch.md +2 -2
- package/api/@xmachines/{play-actor → play-view/index}/functions/createReportGuard.md +2 -2
- package/api/@xmachines/{play-actor → play-view/index}/functions/createViewStoreLifecycle.md +2 -2
- package/api/@xmachines/{play-actor → play-view/index}/functions/guardContextWrites.md +2 -2
- package/api/@xmachines/{play-actor → play-view/index}/functions/refreshContextSubtree.md +2 -2
- package/api/@xmachines/{play-actor → play-view/index}/functions/reuseComposedState.md +3 -3
- package/api/@xmachines/{play-actor → play-view/index}/functions/sameViewInputs.md +2 -2
- package/api/@xmachines/{play-actor → play-view/index}/functions/toAtomState.md +2 -2
- package/api/@xmachines/{play-actor → play-view/index}/functions/typedSpec.md +2 -2
- package/api/@xmachines/play-view/index/interfaces/BaseActorProviderProps.md +49 -0
- package/api/@xmachines/{play-actor → play-view/index}/interfaces/BaseViewContextValue.md +12 -12
- package/api/@xmachines/{play-actor → play-view/index}/interfaces/FailureLatch.md +6 -5
- package/api/@xmachines/{play-actor → play-view/index}/interfaces/PlaySpec.md +8 -8
- package/api/@xmachines/{play-actor → play-view/index}/interfaces/ReportGuard.md +6 -6
- package/api/@xmachines/{play-actor → play-view/index}/interfaces/ReportGuardMessages.md +6 -6
- package/api/@xmachines/{play-actor → play-view/index}/interfaces/ResolveViewStoreOptions.md +5 -5
- package/api/@xmachines/{play-actor → play-view/index}/interfaces/ViewInputs.md +7 -7
- package/api/@xmachines/{play-actor → play-view/index}/interfaces/ViewStoreLifecycle.md +6 -5
- package/api/@xmachines/{play-actor → play-view/index}/interfaces/ViewStoreResolution.md +7 -7
- package/api/@xmachines/{play-actor → play-view/index}/interfaces/Viewable.md +5 -5
- package/api/@xmachines/play-view/index/type-aliases/ViewActor.md +26 -0
- package/api/@xmachines/{play-actor → play-view/index}/variables/CONTEXT_STATE_KEY.md +2 -2
- package/api/@xmachines/play-vue/README.md +15 -33
- package/api/@xmachines/play-vue/functions/defineRegistry.md +1 -1
- package/api/@xmachines/play-vue/functions/useActor.md +1 -1
- package/api/@xmachines/play-vue/functions/usePlayView.md +1 -1
- package/api/@xmachines/play-vue/interfaces/ActorProviderProps.md +9 -9
- package/api/@xmachines/play-vue/interfaces/PlayUIProviderProps.md +11 -11
- package/api/@xmachines/play-vue/interfaces/ViewContextValue.md +8 -8
- package/api/@xmachines/play-vue/type-aliases/AnyPlayActor.md +11 -3
- package/api/@xmachines/play-vue/type-aliases/ComponentEntry.md +1 -1
- package/api/@xmachines/play-vue/type-aliases/ComponentsMap.md +1 -1
- package/api/@xmachines/play-vue/type-aliases/DefineRegistryOptions.md +2 -2
- package/api/@xmachines/play-vue/variables/PlayRenderer.md +1 -1
- package/api/@xmachines/play-vue/variables/schema.md +71 -0
- package/api/@xmachines/play-vue-router/README.md +34 -77
- package/api/@xmachines/play-vue-router/errors/README.md +8 -0
- package/api/@xmachines/play-vue-router/errors/classes/VueRouterNavigationError.md +193 -0
- package/api/@xmachines/play-vue-router/errors/classes/VueRouterSendError.md +177 -0
- package/api/@xmachines/play-vue-router/index/README.md +20 -0
- package/api/@xmachines/play-vue-router/index/classes/RouteMap.md +157 -0
- package/api/@xmachines/play-vue-router/{classes → index/classes}/VueRouterBridge.md +24 -43
- package/api/@xmachines/play-vue-router/index/interfaces/PlayRouteEvent.md +130 -0
- package/api/@xmachines/play-vue-router/index/interfaces/RoutableActor.md +72 -0
- package/api/@xmachines/play-vue-router/{interfaces → index/interfaces}/RouteMapOptions.md +5 -5
- package/api/@xmachines/play-vue-router/{interfaces → index/interfaces}/RouteMapping.md +6 -6
- package/api/@xmachines/play-vue-router/{interfaces → index/interfaces}/RouterBridge.md +5 -5
- package/api/@xmachines/play-vue-router/{variables → index/variables}/PlayRouterProvider.md +4 -4
- package/api/@xmachines/play-xstate/README.md +153 -105
- package/api/@xmachines/play-xstate/errors/README.md +13 -0
- package/api/@xmachines/play-xstate/errors/classes/ActorThrewNonErrorError.md +199 -0
- package/api/@xmachines/play-xstate/errors/classes/InvalidEventError.md +198 -0
- package/api/@xmachines/play-xstate/errors/classes/InvalidMachineError.md +169 -0
- package/api/@xmachines/play-xstate/errors/classes/InvalidRouteHandlerError.md +197 -0
- package/api/@xmachines/play-xstate/errors/classes/InvalidRouteMetadataError.md +176 -0
- package/api/@xmachines/play-xstate/errors/classes/MissingRouteParamError.md +199 -0
- package/api/@xmachines/play-xstate/errors/classes/MissingStateIdError.md +203 -0
- package/api/@xmachines/play-xstate/index/README.md +38 -0
- package/api/@xmachines/play-xstate/index/classes/PlayerActor.md +584 -0
- package/api/@xmachines/play-xstate/index/functions/compose.md +224 -0
- package/api/@xmachines/play-xstate/index/functions/definePlayer.md +158 -0
- package/api/@xmachines/play-xstate/index/interfaces/PlayerConfig.md +22 -0
- package/api/@xmachines/play-xstate/{interfaces → index/interfaces}/PlayerFactoryResumeOptions.md +3 -3
- package/api/@xmachines/play-xstate/{interfaces → index/interfaces}/PlayerOptions.md +8 -8
- package/api/@xmachines/play-xstate/index/type-aliases/Capability.md +33 -0
- package/api/@xmachines/play-xstate/index/type-aliases/PlayerConstructor.md +39 -0
- package/api/@xmachines/play-xstate/index/type-aliases/PlayerFactory.md +27 -0
- package/api/@xmachines/{play-router → play-xstate/index}/variables/DISPOSE.md +3 -3
- package/api/@xmachines/play-xstate/with-routing/README.md +46 -0
- package/api/@xmachines/play-xstate/{functions → with-routing/functions}/buildRouteUrl.md +2 -2
- package/api/@xmachines/play-xstate/{functions → with-routing/functions}/deriveRoute.md +4 -4
- package/api/@xmachines/play-xstate/{functions → with-routing/functions}/formatPlayRouteTransitions.md +2 -2
- package/api/@xmachines/play-xstate/{functions → with-routing/functions}/isAbsoluteRoute.md +3 -3
- package/api/@xmachines/play-xstate/with-routing/functions/withRouting.md +36 -0
- package/api/@xmachines/play-xstate/{interfaces → with-routing/interfaces}/RouteContext.md +6 -6
- package/api/@xmachines/play-xstate/with-routing/interfaces/RouteObject.md +34 -0
- package/api/@xmachines/play-xstate/with-routing/type-aliases/RouteData.md +12 -0
- package/api/@xmachines/play-xstate/with-routing/type-aliases/RouteDataResolver.md +31 -0
- package/api/@xmachines/play-xstate/{type-aliases → with-routing/type-aliases}/RouteMachineConfig.md +5 -5
- package/api/@xmachines/play-xstate/with-routing/type-aliases/RouteMetadata.md +11 -0
- package/api/@xmachines/play-xstate/{type-aliases → with-routing/type-aliases}/RouteStateNode.md +21 -7
- package/api/@xmachines/play-xstate/with-view/README.md +31 -0
- package/api/@xmachines/play-xstate/with-view/functions/withView.md +32 -0
- package/api/@xmachines/shared/README.md +10 -32
- package/api/@xmachines/shared/vite-aliases/functions/xmAliases.md +1 -1
- package/api/@xmachines/shared/vite-aliases/functions/xmCacheDir.md +1 -1
- package/api/@xmachines/shared/vite-aliases/functions/xmOptimizeDeps.md +1 -1
- package/api/@xmachines/shared/vite-aliases/functions/xmResolve.md +1 -1
- package/api/@xmachines/shared/vite-aliases/functions/xmSvelteRunes.md +2 -2
- package/api/@xmachines/shared/vitest/functions/defineXmBrowserConfig.md +1 -1
- package/api/@xmachines/shared/vitest/functions/defineXmVitestConfig.md +2 -1
- package/api/@xmachines/shared/vitest/interfaces/XmBrowserConfigOptions.md +4 -4
- package/api/README.md +2 -0
- package/api/llms.txt +15 -10
- package/contributing/architecture.md +94 -66
- package/contributing/configuration.md +85 -26
- package/contributing/deployment.md +30 -28
- package/contributing/development.md +51 -10
- package/contributing/testing.md +87 -28
- package/examples/README.md +9 -7
- package/examples/form-validation.md +3 -2
- package/examples/multi-router-integration.md +61 -39
- package/examples/routing-patterns.md +15 -14
- package/examples/traffic-light.md +11 -5
- package/guides/README.md +1 -0
- package/guides/actor-model.md +35 -26
- package/guides/getting-started.md +49 -46
- package/guides/inspector.md +4 -4
- package/guides/routing.md +245 -0
- package/guides/state-machines.md +16 -17
- package/package.json +10 -9
- package/rfc/play.md +35 -22
- package/api/@xmachines/play-actor/classes/AbstractActor.md +0 -505
- package/api/@xmachines/play-actor/interfaces/BaseActorProviderProps.md +0 -48
- package/api/@xmachines/play-actor/interfaces/Routable.md +0 -14
- package/api/@xmachines/play-dom/type-aliases/DisposablePlayUI.md +0 -36
- package/api/@xmachines/play-dom-router/functions/createRouteMap.md +0 -40
- package/api/@xmachines/play-dom-router/interfaces/DisposableBrowserHistory.md +0 -262
- package/api/@xmachines/play-dom-router/interfaces/DisposableVanillaRouter.md +0 -80
- package/api/@xmachines/play-dom-router/interfaces/RouteMap.md +0 -122
- package/api/@xmachines/play-react/type-aliases/PlayRendererProps.md +0 -13
- package/api/@xmachines/play-react-router/functions/createRouteMap.md +0 -40
- package/api/@xmachines/play-react-router/interfaces/PlayActor.md +0 -70
- package/api/@xmachines/play-router/functions/getNavigableRoutes.md +0 -35
- package/api/@xmachines/play-router/functions/getPatternParamNames.md +0 -24
- package/api/@xmachines/play-router/functions/getRequiredPatternParamNames.md +0 -36
- package/api/@xmachines/play-router/functions/routeExists.md +0 -26
- package/api/@xmachines/play-router/interfaces/BuildPlayRouteEventOptions.md +0 -13
- package/api/@xmachines/play-router/interfaces/MachineEdgeData.md +0 -15
- package/api/@xmachines/play-router/interfaces/MachineNodeData.md +0 -17
- package/api/@xmachines/play-router/interfaces/PlayActor.md +0 -70
- package/api/@xmachines/play-router/interfaces/PlayRouteEvent.md +0 -135
- package/api/@xmachines/play-router/interfaces/RoutableActor.md +0 -65
- package/api/@xmachines/play-router/interfaces/RouteMatch.md +0 -12
- package/api/@xmachines/play-router/interfaces/RouteObject.md +0 -21
- package/api/@xmachines/play-router/interfaces/RouteTree.md +0 -21
- package/api/@xmachines/play-router/type-aliases/BaseRouteMapping.md +0 -13
- package/api/@xmachines/play-router/type-aliases/PlayRouterBridgeConstructor.md +0 -36
- package/api/@xmachines/play-router/type-aliases/RouteMetadata.md +0 -11
- package/api/@xmachines/play-solid-router/functions/createRouteMap.md +0 -40
- package/api/@xmachines/play-solid-router/interfaces/AbstractActor.md +0 -471
- package/api/@xmachines/play-solid-router/type-aliases/RoutableActor.md +0 -13
- package/api/@xmachines/play-svelte-spa-router/functions/createRouteMap.md +0 -40
- package/api/@xmachines/play-svelte-spa-router/type-aliases/RoutableActor.md +0 -9
- package/api/@xmachines/play-sveltekit-router/functions/createRouteMap.md +0 -40
- package/api/@xmachines/play-sveltekit-router/type-aliases/RoutableActor.md +0 -9
- package/api/@xmachines/play-tanstack-react-router/functions/createRouteMap.md +0 -40
- package/api/@xmachines/play-tanstack-react-router/functions/extractMachineRoutes.md +0 -29
- package/api/@xmachines/play-tanstack-react-router/interfaces/PlayActor.md +0 -70
- package/api/@xmachines/play-tanstack-react-router/interfaces/RouteNavigateEvent.md +0 -31
- package/api/@xmachines/play-tanstack-solid-router/functions/createRouteMap.md +0 -40
- package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayActor.md +0 -70
- package/api/@xmachines/play-tanstack-solid-router/type-aliases/RoutableActor.md +0 -13
- package/api/@xmachines/play-vue/interfaces/VisibilityProviderProps.md +0 -9
- package/api/@xmachines/play-vue/variables/getPlayViewContext.md +0 -39
- package/api/@xmachines/play-vue-router/functions/createRouteMap.md +0 -40
- package/api/@xmachines/play-vue-router/interfaces/PlayActor.md +0 -70
- package/api/@xmachines/play-vue-router/interfaces/PlayRouteEvent.md +0 -135
- package/api/@xmachines/play-vue-router/type-aliases/RoutableActor.md +0 -13
- package/api/@xmachines/play-vue-router/type-aliases/VueRouteMap.md +0 -13
- package/api/@xmachines/play-vue-router/variables/VueRouteMap.md +0 -13
- package/api/@xmachines/play-xstate/classes/PlayerActor.md +0 -568
- package/api/@xmachines/play-xstate/functions/composeGuards.md +0 -86
- package/api/@xmachines/play-xstate/functions/composeGuardsOr.md +0 -72
- package/api/@xmachines/play-xstate/functions/contextFieldMatches.md +0 -43
- package/api/@xmachines/play-xstate/functions/definePlayer.md +0 -78
- package/api/@xmachines/play-xstate/functions/eventMatches.md +0 -45
- package/api/@xmachines/play-xstate/functions/hasContext.md +0 -45
- package/api/@xmachines/play-xstate/functions/negateGuard.md +0 -67
- package/api/@xmachines/play-xstate/interfaces/PlayerConfig.md +0 -20
- package/api/@xmachines/play-xstate/interfaces/RouteObject.md +0 -17
- package/api/@xmachines/play-xstate/type-aliases/ComposedGuard.md +0 -19
- package/api/@xmachines/play-xstate/type-aliases/Guard.md +0 -36
- package/api/@xmachines/play-xstate/type-aliases/GuardArray.md +0 -23
- package/api/@xmachines/play-xstate/type-aliases/PlayerFactory.md +0 -26
- package/api/@xmachines/play-xstate/type-aliases/RouteMetadata.md +0 -9
|
@@ -0,0 +1,584 @@
|
|
|
1
|
+
[API](../../../../README.md) / [@xmachines/play-xstate](../../README.md) / [index](../README.md) / PlayerActor
|
|
2
|
+
|
|
3
|
+
# Class: PlayerActor\<TMachine\>
|
|
4
|
+
|
|
5
|
+
Defined in: [packages/play-xstate/src/player-actor.ts:160](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v4.0.0/packages/play-xstate/src/player-actor.ts#L160)
|
|
6
|
+
|
|
7
|
+
The concrete XState actor. It implements the signal protocol of the Play Architecture
|
|
8
|
+
|
|
9
|
+
The class extends the `Actor` class of XState directly, and it implements
|
|
10
|
+
[@xmachines/play-actor!PlayActor](../../../play-actor/interfaces/PlayActor.md). It gives you the XState v5 integration, and it keeps the
|
|
11
|
+
compatibility with the ecosystem, such as the XState inspection and the devtools.
|
|
12
|
+
The constructor of the base class receives the machine. Therefore a `PlayerActor`
|
|
13
|
+
**is** the XState actor, and it is no wrapper around one: every member of the
|
|
14
|
+
XState `Actor` class works on the state of this instance, and this class adds the
|
|
15
|
+
reactive state on the TC39 Signals for the observation by the infrastructure.
|
|
16
|
+
|
|
17
|
+
**Capabilities:** the class implements both the
|
|
18
|
+
[@xmachines/play-router!index.Routable](../../../play-router/index/interfaces/Routable.md) interface and the
|
|
19
|
+
[@xmachines/play-view!index.Viewable](../../../play-view/index/interfaces/Viewable.md) interface. It therefore supports the
|
|
20
|
+
routing and the view rendering.
|
|
21
|
+
|
|
22
|
+
**Architectural context:** the class implements **Actor Authority (INV-01)**,
|
|
23
|
+
because the guards of the XState machine control every decision of the
|
|
24
|
+
navigation. The infrastructure observes the signals of the actor (`state`,
|
|
25
|
+
`currentRoute`, and `currentView`), but it changes no state directly: every
|
|
26
|
+
change goes through the event handlers of the state machine.
|
|
27
|
+
|
|
28
|
+
## Examples
|
|
29
|
+
|
|
30
|
+
The creation of an actor, and its lifecycle
|
|
31
|
+
|
|
32
|
+
```typescript
|
|
33
|
+
import { setup } from "xstate";
|
|
34
|
+
import { definePlayer, compose, PlayerActor } from "@xmachines/play-xstate";
|
|
35
|
+
|
|
36
|
+
const machine = setup({}).createMachine({
|
|
37
|
+
initial: "idle",
|
|
38
|
+
states: {
|
|
39
|
+
idle: {
|
|
40
|
+
meta: {
|
|
41
|
+
route: "/",
|
|
42
|
+
// A view spec needs `root` and `elements`. Every other shape derives null.
|
|
43
|
+
view: {
|
|
44
|
+
root: "home",
|
|
45
|
+
elements: { home: { type: "HomePage", props: {}, children: [] } },
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
const createPlayer = definePlayer({ machine });
|
|
53
|
+
const actor = createPlayer();
|
|
54
|
+
actor.start();
|
|
55
|
+
|
|
56
|
+
// Observe the signals
|
|
57
|
+
console.log(actor.currentRoute.get()); // '/'
|
|
58
|
+
console.log(actor.currentView.get()?.root); // 'home'
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
The signal lifecycle with a watcher
|
|
62
|
+
|
|
63
|
+
```typescript
|
|
64
|
+
import { Signal } from "@xmachines/play-signals";
|
|
65
|
+
|
|
66
|
+
const watcher = new Signal.subtle.Watcher(() => {
|
|
67
|
+
queueMicrotask(() => {
|
|
68
|
+
const pending = watcher.getPending();
|
|
69
|
+
console.log("State changed:", actor.state.get());
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
watcher.watch(actor.state);
|
|
74
|
+
actor.send({ type: "play.route", to: "#about" });
|
|
75
|
+
// The watcher schedules its own notification in a microtask
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## See
|
|
79
|
+
|
|
80
|
+
- [Play RFC](../../../../../rfc/play.md)
|
|
81
|
+
- [definePlayer](../functions/definePlayer.md) for the creation through a factory
|
|
82
|
+
- [@xmachines/play-actor!PlayActor](../../../play-actor/interfaces/PlayActor.md) for the signal protocol
|
|
83
|
+
- [@xmachines/play-router!index.Routable](../../../play-router/index/interfaces/Routable.md) for the routing capability
|
|
84
|
+
- [@xmachines/play-view!index.Viewable](../../../play-view/index/interfaces/Viewable.md) for the view rendering capability
|
|
85
|
+
|
|
86
|
+
## Remarks
|
|
87
|
+
|
|
88
|
+
**The routing:** this actor supports the `route: {}` config pattern of XState and
|
|
89
|
+
also a `play.route` event with parameters. The `deriveRoute()` function reads
|
|
90
|
+
`meta.route`, which is the Stately pattern, for a URL template, and it substitutes
|
|
91
|
+
each parameter.
|
|
92
|
+
|
|
93
|
+
**The pattern of the view signal:** the `currentView` signal is a direct
|
|
94
|
+
`Signal.State`, and not a `Signal.Computed`. The propagation to a watcher in
|
|
95
|
+
PlayRenderer is therefore correct. The class derives each view at the entry of a
|
|
96
|
+
state and keeps it, and it computes no view on a read.
|
|
97
|
+
|
|
98
|
+
## Extends
|
|
99
|
+
|
|
100
|
+
- [`Actor`](https://www.jsdocs.io/package/xstate#Actor)\<`TMachine`\>
|
|
101
|
+
|
|
102
|
+
## Type Parameters
|
|
103
|
+
|
|
104
|
+
| Type Parameter | Description |
|
|
105
|
+
| ---------------------------------------------------------------------------------------------- | --------------------------------------- |
|
|
106
|
+
| `TMachine` _extends_ [`AnyStateMachine`](https://www.jsdocs.io/package/xstate#AnyStateMachine) | The type of the XState v5 state machine |
|
|
107
|
+
|
|
108
|
+
## Implements
|
|
109
|
+
|
|
110
|
+
- [`PlayActor`](../../../play-actor/interfaces/PlayActor.md)\<`ReturnType`\<`TMachine`\[`"transition"`\]\>, [`EventFromLogic`](https://www.jsdocs.io/package/xstate#EventFromLogic)\<`TMachine`\>\>
|
|
111
|
+
|
|
112
|
+
## Constructors
|
|
113
|
+
|
|
114
|
+
### Constructor
|
|
115
|
+
|
|
116
|
+
```ts
|
|
117
|
+
new PlayerActor<TMachine>(
|
|
118
|
+
machine,
|
|
119
|
+
options,
|
|
120
|
+
input?,
|
|
121
|
+
restoredSnapshot?
|
|
122
|
+
): PlayerActor<TMachine>;
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Defined in: [packages/play-xstate/src/player-actor.ts:258](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v4.0.0/packages/play-xstate/src/player-actor.ts#L258)
|
|
126
|
+
|
|
127
|
+
#### Parameters
|
|
128
|
+
|
|
129
|
+
| Parameter | Type |
|
|
130
|
+
| ------------------- | --------------------------------------------------------------------------- |
|
|
131
|
+
| `machine` | `TMachine` |
|
|
132
|
+
| `options` | [`PlayerOptions`](../interfaces/PlayerOptions.md)\<`TMachine`\> |
|
|
133
|
+
| `input?` | [`InputFrom`](https://www.jsdocs.io/package/xstate#InputFrom)\<`TMachine`\> |
|
|
134
|
+
| `restoredSnapshot?` | [`Snapshot`](https://www.jsdocs.io/package/xstate#Snapshot)\<`unknown`\> |
|
|
135
|
+
|
|
136
|
+
#### Returns
|
|
137
|
+
|
|
138
|
+
`PlayerActor`\<`TMachine`\>
|
|
139
|
+
|
|
140
|
+
#### Overrides
|
|
141
|
+
|
|
142
|
+
```ts
|
|
143
|
+
Actor<TMachine>.constructor
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Properties
|
|
147
|
+
|
|
148
|
+
| Property | Modifier | Type | Description | Inherited from | Defined in |
|
|
149
|
+
| ------------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
150
|
+
| <a id="property-_parent"></a> `_parent?` | `public` | [`AnyActorRef`](https://www.jsdocs.io/package/xstate#AnyActorRef) | - | `Actor._parent` | - |
|
|
151
|
+
| <a id="property-clock"></a> `clock` | `public` | [`Clock`](https://www.jsdocs.io/package/xstate#Clock) | The clock that is responsible for setting and clearing timeouts, such as delayed events and transitions. | `Actor.clock` | - |
|
|
152
|
+
| <a id="property-id"></a> `id` | `public` | `string` | The unique identifier for this actor relative to its parent. | `Actor.id` | - |
|
|
153
|
+
| <a id="property-logic"></a> `logic` | `public` | `TMachine` | - | `Actor.logic` | - |
|
|
154
|
+
| <a id="property-options"></a> `options` | `public` | `Readonly`\<[`ActorOptions`](https://www.jsdocs.io/package/xstate#ActorOptions)\<`TLogic`\>\> | - | `Actor.options` | - |
|
|
155
|
+
| <a id="property-ref"></a> `ref` | `public` | [`ActorRef`](https://www.jsdocs.io/package/xstate#ActorRef)\<[`SnapshotFrom`](https://www.jsdocs.io/package/xstate#SnapshotFrom)\<`TMachine`\>, [`EventFromLogic`](https://www.jsdocs.io/package/xstate#EventFromLogic)\<`TMachine`\>, [`EmittedFrom`](https://www.jsdocs.io/package/xstate#EmittedFrom)\<`TMachine`\>\> | - | `Actor.ref` | - |
|
|
156
|
+
| <a id="property-sessionid"></a> `sessionId` | `public` | `string` | The globally unique process ID for this invocation. | `Actor.sessionId` | - |
|
|
157
|
+
| <a id="property-src"></a> `src` | `public` | \| `string` \| [`AnyActorLogic`](https://www.jsdocs.io/package/xstate#AnyActorLogic) | - | `Actor.src` | - |
|
|
158
|
+
| <a id="property-state"></a> `state` | `public` | [`State`](../../../play-signals/namespaces/Signal/classes/State.md)\<`ReturnType`\<`TMachine`\[`"transition"`\]\>\> | The reactive snapshot of the current actor state. The infrastructure observes this signal, and it reacts to each state change. It therefore holds no coupling to the internal state machine of the actor. | - | [packages/play-xstate/src/player-actor.ts:224](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v4.0.0/packages/play-xstate/src/player-actor.ts#L224) |
|
|
159
|
+
| <a id="property-system"></a> `system` | `public` | [`AnyActorSystem`](https://www.jsdocs.io/package/xstate#AnyActorSystem) | The system to which this actor belongs. | `Actor.system` | - |
|
|
160
|
+
| <a id="property-systemid"></a> `systemId` | `public` | `string` \| `undefined` | - | `Actor.systemId` | - |
|
|
161
|
+
|
|
162
|
+
## Methods
|
|
163
|
+
|
|
164
|
+
### \[dispose\]()
|
|
165
|
+
|
|
166
|
+
```ts
|
|
167
|
+
dispose: void;
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
Defined in: [packages/play-xstate/src/player-actor.ts:611](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v4.0.0/packages/play-xstate/src/player-actor.ts#L611)
|
|
171
|
+
|
|
172
|
+
Stops the actor when the scope of a `using` declaration ends.
|
|
173
|
+
|
|
174
|
+
The actor is a `Disposable`, so a scope that owns one writes no teardown:
|
|
175
|
+
|
|
176
|
+
```ts
|
|
177
|
+
{
|
|
178
|
+
using actor = definePlayer({ machine })();
|
|
179
|
+
actor.start();
|
|
180
|
+
actor.send({ type: "go" });
|
|
181
|
+
// stop() runs here, and it runs even when send() throws
|
|
182
|
+
}
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
The release is [stop](#stop), which is synchronous and idempotent. `Disposable` and
|
|
186
|
+
not `AsyncDisposable`: a `Disposable` serves `using` AND `await using`, while an
|
|
187
|
+
`AsyncDisposable` raises a TypeError under a plain `using`.
|
|
188
|
+
|
|
189
|
+
The key is `DISPOSE` of `@xmachines/play` and not a bare `Symbol.dispose`, so that
|
|
190
|
+
the method still answers a `using` that a bundler downlevelled for a target without
|
|
191
|
+
the well-known symbol.
|
|
192
|
+
|
|
193
|
+
#### Returns
|
|
194
|
+
|
|
195
|
+
`void`
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
### \[observable\]()
|
|
200
|
+
|
|
201
|
+
```ts
|
|
202
|
+
observable: InteropSubscribable<SnapshotFrom<TMachine>>;
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
Defined in: `xstate`
|
|
206
|
+
|
|
207
|
+
#### Returns
|
|
208
|
+
|
|
209
|
+
[`InteropSubscribable`](https://www.jsdocs.io/package/xstate#InteropSubscribable)\<[`SnapshotFrom`](https://www.jsdocs.io/package/xstate#SnapshotFrom)\<`TMachine`\>\>
|
|
210
|
+
|
|
211
|
+
#### Inherited from
|
|
212
|
+
|
|
213
|
+
```ts
|
|
214
|
+
Actor.[observable]
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
---
|
|
218
|
+
|
|
219
|
+
### can()
|
|
220
|
+
|
|
221
|
+
```ts
|
|
222
|
+
can(event): boolean;
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
Defined in: [packages/play-xstate/src/player-actor.ts:237](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v4.0.0/packages/play-xstate/src/player-actor.ts#L237)
|
|
226
|
+
|
|
227
|
+
Tells you if the current state of the actor accepts the given event.
|
|
228
|
+
|
|
229
|
+
The type is the event union of the machine. An unknown event type is therefore a
|
|
230
|
+
compile error. The method evaluates the event against the snapshot signal.
|
|
231
|
+
|
|
232
|
+
#### Parameters
|
|
233
|
+
|
|
234
|
+
| Parameter | Type |
|
|
235
|
+
| --------- | ------------------------------------------------------------------------------------- |
|
|
236
|
+
| `event` | [`EventFromLogic`](https://www.jsdocs.io/package/xstate#EventFromLogic)\<`TMachine`\> |
|
|
237
|
+
|
|
238
|
+
#### Returns
|
|
239
|
+
|
|
240
|
+
`boolean`
|
|
241
|
+
|
|
242
|
+
#### Example
|
|
243
|
+
|
|
244
|
+
```typescript
|
|
245
|
+
if (actor.can({ type: "auth.logout" })) { ... }
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
---
|
|
249
|
+
|
|
250
|
+
### getPersistedSnapshot()
|
|
251
|
+
|
|
252
|
+
```ts
|
|
253
|
+
getPersistedSnapshot(options?): Snapshot<unknown>;
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
Defined in: [packages/play-xstate/src/player-actor.ts:562](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v4.0.0/packages/play-xstate/src/player-actor.ts#L562)
|
|
257
|
+
|
|
258
|
+
Returns the persisted snapshot of this actor.
|
|
259
|
+
|
|
260
|
+
Use it to serialize the state, and to restore it later with the
|
|
261
|
+
`restore.snapshot` option of the factory.
|
|
262
|
+
|
|
263
|
+
#### Parameters
|
|
264
|
+
|
|
265
|
+
| Parameter | Type |
|
|
266
|
+
| ---------- | --------- |
|
|
267
|
+
| `options?` | `unknown` |
|
|
268
|
+
|
|
269
|
+
#### Returns
|
|
270
|
+
|
|
271
|
+
[`Snapshot`](https://www.jsdocs.io/package/xstate#Snapshot)\<`unknown`\>
|
|
272
|
+
|
|
273
|
+
#### Overrides
|
|
274
|
+
|
|
275
|
+
```ts
|
|
276
|
+
Actor.getPersistedSnapshot;
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
---
|
|
280
|
+
|
|
281
|
+
### getSnapshot()
|
|
282
|
+
|
|
283
|
+
```ts
|
|
284
|
+
getSnapshot(): SnapshotFrom<TMachine>;
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
Defined in: `xstate`
|
|
288
|
+
|
|
289
|
+
Read an actor’s snapshot synchronously.
|
|
290
|
+
|
|
291
|
+
#### Returns
|
|
292
|
+
|
|
293
|
+
[`SnapshotFrom`](https://www.jsdocs.io/package/xstate#SnapshotFrom)\<`TMachine`\>
|
|
294
|
+
|
|
295
|
+
#### Remarks
|
|
296
|
+
|
|
297
|
+
The snapshot represent an actor's last emitted value.
|
|
298
|
+
|
|
299
|
+
When an actor receives an event, its internal state may change. An actor
|
|
300
|
+
may emit a snapshot when a state transition occurs.
|
|
301
|
+
|
|
302
|
+
Note that some actors, such as callback actors generated with
|
|
303
|
+
`fromCallback`, will not emit snapshots.
|
|
304
|
+
|
|
305
|
+
#### See
|
|
306
|
+
|
|
307
|
+
- [Actor.subscribe](https://www.jsdocs.io/package/xstate#Actor.subscribe) to subscribe to an actor’s snapshot values.
|
|
308
|
+
- [Actor.getPersistedSnapshot](https://www.jsdocs.io/package/xstate#Actor.getPersistedSnapshot) to persist the internal state of an actor (which is more than just a snapshot).
|
|
309
|
+
|
|
310
|
+
#### Inherited from
|
|
311
|
+
|
|
312
|
+
```ts
|
|
313
|
+
Actor.getSnapshot;
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
---
|
|
317
|
+
|
|
318
|
+
### on()
|
|
319
|
+
|
|
320
|
+
```ts
|
|
321
|
+
on<TType>(type, handler): Subscription;
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
Defined in: `xstate`
|
|
325
|
+
|
|
326
|
+
#### Type Parameters
|
|
327
|
+
|
|
328
|
+
| Type Parameter |
|
|
329
|
+
| ----------------------- |
|
|
330
|
+
| `TType` _extends_ `any` |
|
|
331
|
+
|
|
332
|
+
#### Parameters
|
|
333
|
+
|
|
334
|
+
| Parameter | Type |
|
|
335
|
+
| --------- | --------------------- |
|
|
336
|
+
| `type` | `TType` |
|
|
337
|
+
| `handler` | (`emitted`) => `void` |
|
|
338
|
+
|
|
339
|
+
#### Returns
|
|
340
|
+
|
|
341
|
+
[`Subscription`](https://www.jsdocs.io/package/xstate#Subscription)
|
|
342
|
+
|
|
343
|
+
#### Inherited from
|
|
344
|
+
|
|
345
|
+
```ts
|
|
346
|
+
Actor.on;
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
---
|
|
350
|
+
|
|
351
|
+
### select()
|
|
352
|
+
|
|
353
|
+
```ts
|
|
354
|
+
select<TSelected>(selector, equalityFn?): Readable<TSelected>;
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
Defined in: `xstate`
|
|
358
|
+
|
|
359
|
+
#### Type Parameters
|
|
360
|
+
|
|
361
|
+
| Type Parameter |
|
|
362
|
+
| -------------- |
|
|
363
|
+
| `TSelected` |
|
|
364
|
+
|
|
365
|
+
#### Parameters
|
|
366
|
+
|
|
367
|
+
| Parameter | Type |
|
|
368
|
+
| ------------- | --------------------------- |
|
|
369
|
+
| `selector` | (`snapshot`) => `TSelected` |
|
|
370
|
+
| `equalityFn?` | (`a`, `b`) => `boolean` |
|
|
371
|
+
|
|
372
|
+
#### Returns
|
|
373
|
+
|
|
374
|
+
`Readable`\<`TSelected`\>
|
|
375
|
+
|
|
376
|
+
#### Inherited from
|
|
377
|
+
|
|
378
|
+
```ts
|
|
379
|
+
Actor.select;
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
---
|
|
383
|
+
|
|
384
|
+
### send()
|
|
385
|
+
|
|
386
|
+
```ts
|
|
387
|
+
send(event): void;
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
Defined in: [packages/play-xstate/src/player-actor.ts:439](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v4.0.0/packages/play-xstate/src/player-actor.ts#L439)
|
|
391
|
+
|
|
392
|
+
Sends an event to this actor.
|
|
393
|
+
|
|
394
|
+
The guards of the state machine of the actor decide if the event causes a
|
|
395
|
+
transition. Give any event of the event union of the machine: a domain event, a
|
|
396
|
+
routing event, and so on.
|
|
397
|
+
|
|
398
|
+
#### Parameters
|
|
399
|
+
|
|
400
|
+
| Parameter | Type | Description |
|
|
401
|
+
| --------- | ------------------------------------------------------------------------------------- | ---------------------------------------------------------------- |
|
|
402
|
+
| `event` | [`EventFromLogic`](https://www.jsdocs.io/package/xstate#EventFromLogic)\<`TMachine`\> | An event of the `EventFromLogic<TMachine>` union of the machine. |
|
|
403
|
+
|
|
404
|
+
#### Returns
|
|
405
|
+
|
|
406
|
+
`void`
|
|
407
|
+
|
|
408
|
+
#### Throws
|
|
409
|
+
|
|
410
|
+
When `event` is not a plain object, for example
|
|
411
|
+
`null`, `undefined`, a string, or a number. Import the class from
|
|
412
|
+
`@xmachines/play-xstate/errors`.
|
|
413
|
+
|
|
414
|
+
#### Example
|
|
415
|
+
|
|
416
|
+
```typescript
|
|
417
|
+
// A domain event, with the type of the event union of the machine
|
|
418
|
+
actor.send({ type: "auth.login", userId: "123" });
|
|
419
|
+
|
|
420
|
+
// A routing event
|
|
421
|
+
actor.send({ type: "play.route", to: "#home" });
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
#### Implementation of
|
|
425
|
+
|
|
426
|
+
[`PlayActor`](../../../play-actor/interfaces/PlayActor.md).[`send`](../../../play-actor/interfaces/PlayActor.md#send)
|
|
427
|
+
|
|
428
|
+
#### Overrides
|
|
429
|
+
|
|
430
|
+
```ts
|
|
431
|
+
Actor.send;
|
|
432
|
+
```
|
|
433
|
+
|
|
434
|
+
---
|
|
435
|
+
|
|
436
|
+
### start()
|
|
437
|
+
|
|
438
|
+
```ts
|
|
439
|
+
start(): this;
|
|
440
|
+
```
|
|
441
|
+
|
|
442
|
+
Defined in: [packages/play-xstate/src/player-actor.ts:365](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v4.0.0/packages/play-xstate/src/player-actor.ts#L365)
|
|
443
|
+
|
|
444
|
+
Starts the actor.
|
|
445
|
+
|
|
446
|
+
The method fires `onStart` on each real start, which is every transition from
|
|
447
|
+
"not running" to "running". A start after a stop is such a transition, and XState
|
|
448
|
+
permits it: its own `start()` stops only while the actor RUNS already. A second
|
|
449
|
+
call while the actor runs fires no hook. Therefore a defensive double mount runs
|
|
450
|
+
the side effects of `onStart` one time for one real start.
|
|
451
|
+
|
|
452
|
+
#### Returns
|
|
453
|
+
|
|
454
|
+
`this`
|
|
455
|
+
|
|
456
|
+
#### Overrides
|
|
457
|
+
|
|
458
|
+
```ts
|
|
459
|
+
Actor.start;
|
|
460
|
+
```
|
|
461
|
+
|
|
462
|
+
---
|
|
463
|
+
|
|
464
|
+
### stop()
|
|
465
|
+
|
|
466
|
+
```ts
|
|
467
|
+
stop(): this;
|
|
468
|
+
```
|
|
469
|
+
|
|
470
|
+
Defined in: [packages/play-xstate/src/player-actor.ts:395](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v4.0.0/packages/play-xstate/src/player-actor.ts#L395)
|
|
471
|
+
|
|
472
|
+
Stops the actor and cleans up.
|
|
473
|
+
|
|
474
|
+
The method fires `onStop` only when the actor ran. This matches XState, where a
|
|
475
|
+
stop of an actor that never started, or of an actor that stopped already, does
|
|
476
|
+
nothing and tears nothing down. Therefore the paired cleanup runs never two
|
|
477
|
+
times, and it runs never against a resource that `onStart` did not take. A stop
|
|
478
|
+
does not close the actor for ever: a later `start()` is a new lifecycle, and it
|
|
479
|
+
fires `onStart` again.
|
|
480
|
+
|
|
481
|
+
#### Returns
|
|
482
|
+
|
|
483
|
+
`this`
|
|
484
|
+
|
|
485
|
+
#### Overrides
|
|
486
|
+
|
|
487
|
+
```ts
|
|
488
|
+
Actor.stop;
|
|
489
|
+
```
|
|
490
|
+
|
|
491
|
+
---
|
|
492
|
+
|
|
493
|
+
### subscribe()
|
|
494
|
+
|
|
495
|
+
#### Call Signature
|
|
496
|
+
|
|
497
|
+
```ts
|
|
498
|
+
subscribe(observer): Subscription;
|
|
499
|
+
```
|
|
500
|
+
|
|
501
|
+
Defined in: [packages/play-xstate/src/player-actor.ts:500](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v4.0.0/packages/play-xstate/src/player-actor.ts#L500)
|
|
502
|
+
|
|
503
|
+
Subscribes to the snapshot updates of this actor.
|
|
504
|
+
|
|
505
|
+
The method accepts an observer object, exactly like `Actor.subscribe` of XState.
|
|
506
|
+
|
|
507
|
+
##### Parameters
|
|
508
|
+
|
|
509
|
+
| Parameter | Type | Description |
|
|
510
|
+
| ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------ |
|
|
511
|
+
| `observer` | [`Observer`](https://www.jsdocs.io/package/xstate#Observer)\<[`SnapshotFrom`](https://www.jsdocs.io/package/xstate#SnapshotFrom)\<`TMachine`\>\> | The observer, with a `next`, an `error`, and a `complete` handler. |
|
|
512
|
+
|
|
513
|
+
##### Returns
|
|
514
|
+
|
|
515
|
+
[`Subscription`](https://www.jsdocs.io/package/xstate#Subscription)
|
|
516
|
+
|
|
517
|
+
The subscription, with an `unsubscribe()` method.
|
|
518
|
+
|
|
519
|
+
##### Overrides
|
|
520
|
+
|
|
521
|
+
```ts
|
|
522
|
+
Actor.subscribe;
|
|
523
|
+
```
|
|
524
|
+
|
|
525
|
+
#### Call Signature
|
|
526
|
+
|
|
527
|
+
```ts
|
|
528
|
+
subscribe(
|
|
529
|
+
nextListener?,
|
|
530
|
+
errorListener?,
|
|
531
|
+
completeListener?
|
|
532
|
+
): Subscription;
|
|
533
|
+
```
|
|
534
|
+
|
|
535
|
+
Defined in: [packages/play-xstate/src/player-actor.ts:511](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v4.0.0/packages/play-xstate/src/player-actor.ts#L511)
|
|
536
|
+
|
|
537
|
+
Subscribes to the snapshot updates of this actor.
|
|
538
|
+
|
|
539
|
+
The method accepts listener functions, exactly like `Actor.subscribe` of XState.
|
|
540
|
+
|
|
541
|
+
##### Parameters
|
|
542
|
+
|
|
543
|
+
| Parameter | Type | Description |
|
|
544
|
+
| ------------------- | ---------------------- | -------------------------------------------------------------------------------- |
|
|
545
|
+
| `nextListener?` | (`snapshot`) => `void` | The listener function of each snapshot. |
|
|
546
|
+
| `errorListener?` | (`error`) => `void` | The actor calls it on an error. |
|
|
547
|
+
| `completeListener?` | () => `void` | The actor calls it when it completes, which means that it reaches a final state. |
|
|
548
|
+
|
|
549
|
+
##### Returns
|
|
550
|
+
|
|
551
|
+
[`Subscription`](https://www.jsdocs.io/package/xstate#Subscription)
|
|
552
|
+
|
|
553
|
+
The subscription, with an `unsubscribe()` method.
|
|
554
|
+
|
|
555
|
+
##### Overrides
|
|
556
|
+
|
|
557
|
+
```ts
|
|
558
|
+
Actor.subscribe;
|
|
559
|
+
```
|
|
560
|
+
|
|
561
|
+
---
|
|
562
|
+
|
|
563
|
+
### toJSON()
|
|
564
|
+
|
|
565
|
+
```ts
|
|
566
|
+
toJSON(): object;
|
|
567
|
+
```
|
|
568
|
+
|
|
569
|
+
Defined in: `xstate`
|
|
570
|
+
|
|
571
|
+
#### Returns
|
|
572
|
+
|
|
573
|
+
`object`
|
|
574
|
+
|
|
575
|
+
| Name | Type | Defined in |
|
|
576
|
+
| -------------- | -------- | ---------- |
|
|
577
|
+
| `id` | `string` | - |
|
|
578
|
+
| `xstate$$type` | `number` | - |
|
|
579
|
+
|
|
580
|
+
#### Inherited from
|
|
581
|
+
|
|
582
|
+
```ts
|
|
583
|
+
Actor.toJSON;
|
|
584
|
+
```
|