@xmachines/docs 2.2.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 +75 -97
- 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/index/functions/asCleanup.md +78 -0
- 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/index/type-aliases/Cleanup.md +38 -0
- package/api/@xmachines/play/index/type-aliases/DisposeKey.md +32 -0
- package/api/@xmachines/play/{type-aliases → index/type-aliases}/PlayEvent.md +4 -4
- package/api/@xmachines/play/index/variables/DISPOSE.md +34 -0
- package/api/@xmachines/play-actor/README.md +78 -222
- 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 +99 -43
- 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 +6 -6
- package/api/@xmachines/play-dom/functions/createRenderer.md +3 -3
- package/api/@xmachines/play-dom/interfaces/CreatePlayUIOptions.md +17 -11
- package/api/@xmachines/play-dom/interfaces/MountOptions.md +5 -4
- package/api/@xmachines/play-dom/interfaces/PlayDomOptions.md +14 -12
- package/api/@xmachines/play-dom/type-aliases/Cleanup.md +38 -0
- package/api/@xmachines/play-dom/type-aliases/MountFn.md +30 -8
- package/api/@xmachines/play-dom-router/README.md +99 -73
- 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 +7 -1
- package/api/@xmachines/play-dom-router/functions/createRouter.md +12 -6
- package/api/@xmachines/play-dom-router/interfaces/BasePathOptions.md +5 -5
- package/api/@xmachines/play-dom-router/interfaces/BrowserHistory.md +73 -19
- package/api/@xmachines/play-dom-router/interfaces/BrowserWindow.md +16 -16
- 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 +36 -7
- package/api/@xmachines/play-dom-router/interfaces/VanillaRouter.md +40 -6
- package/api/@xmachines/play-dom-router/type-aliases/Cleanup.md +38 -0
- package/api/@xmachines/play-dom-router/variables/DISPOSE.md +34 -0
- package/api/@xmachines/play-react/README.md +18 -40
- package/api/@xmachines/play-react/classes/PlayErrorBoundary.md +50 -11
- 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 +8 -6
- package/api/@xmachines/play-react/interfaces/PlayErrorBoundaryState.md +6 -5
- 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 +108 -189
- 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 +38 -9
- 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-router/index/variables/DISPOSE.md +34 -0
- 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-dom-router → play-router/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 +5 -25
- package/api/@xmachines/play-signals/functions/watchSignal.md +27 -4
- 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 +38 -0
- package/api/@xmachines/play-signals/type-aliases/WatcherNotify.md +1 -1
- package/api/@xmachines/play-solid/README.md +36 -35
- package/api/@xmachines/play-solid/functions/useActor.md +1 -1
- package/api/@xmachines/play-solid/functions/usePlayView.md +14 -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 +16 -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 +13 -28
- 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 +7 -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 +36 -7
- 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 +36 -7
- 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-view/index/functions/createFailureLatch.md +20 -0
- package/api/@xmachines/play-view/index/functions/createReportGuard.md +26 -0
- 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-view/index/functions/sameViewInputs.md +25 -0
- 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-view/index/interfaces/FailureLatch.md +60 -0
- package/api/@xmachines/{play-actor → play-view/index}/interfaces/PlaySpec.md +8 -8
- package/api/@xmachines/play-view/index/interfaces/ReportGuard.md +92 -0
- package/api/@xmachines/play-view/index/interfaces/ReportGuardMessages.md +18 -0
- package/api/@xmachines/{play-actor → play-view/index}/interfaces/ResolveViewStoreOptions.md +5 -5
- package/api/@xmachines/play-view/index/interfaces/ViewInputs.md +19 -0
- 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 +46 -42
- 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 +6 -1
- package/api/@xmachines/play-vue/interfaces/ActorProviderProps.md +13 -8
- package/api/@xmachines/play-vue/interfaces/PlayUIProviderProps.md +15 -10
- 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 +163 -98
- 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-xstate/index/variables/DISPOSE.md +34 -0
- 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 +97 -65
- package/contributing/configuration.md +142 -41
- package/contributing/deployment.md +30 -28
- package/contributing/development.md +94 -31
- package/contributing/testing.md +90 -31
- 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 +47 -44
- package/guides/inspector.md +4 -4
- package/guides/routing.md +245 -0
- package/guides/signals.md +43 -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-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/createRouteMap.md +0 -40
- 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 -34
- 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 -532
- 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
|
@@ -1,532 +0,0 @@
|
|
|
1
|
-
[API](../../../README.md) / [@xmachines/play-xstate](../README.md) / PlayerActor
|
|
2
|
-
|
|
3
|
-
# Class: PlayerActor\<TMachine\>
|
|
4
|
-
|
|
5
|
-
Defined in: [packages/play-xstate/src/player-actor.ts:202](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.2.0/packages/play-xstate/src/player-actor.ts#L202)
|
|
6
|
-
|
|
7
|
-
The concrete XState actor. It implements the signal protocol of the Play Architecture
|
|
8
|
-
|
|
9
|
-
The class extends [@xmachines/play-actor!AbstractActor](../../play-actor/classes/AbstractActor.md), and therefore the
|
|
10
|
-
`Actor` class of XState. 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-actor!Routable](../../play-actor/interfaces/Routable.md) interface and the
|
|
19
|
-
[@xmachines/play-actor!Viewable](../../play-actor/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 } 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!AbstractActor](../../play-actor/classes/AbstractActor.md) for the signal protocol
|
|
83
|
-
- [@xmachines/play-actor!Routable](../../play-actor/interfaces/Routable.md) for the routing capability
|
|
84
|
-
- [@xmachines/play-actor!Viewable](../../play-actor/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
|
-
- [`AbstractActor`](../../play-actor/classes/AbstractActor.md)\<[`AnyActorLogic`](https://www.jsdocs.io/package/xstate#AnyActorLogic), [`EventFromLogic`](https://www.jsdocs.io/package/xstate#EventFromLogic)\<`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
|
-
- [`Routable`](../../play-actor/interfaces/Routable.md)
|
|
111
|
-
- [`Viewable`](../../play-actor/interfaces/Viewable.md)
|
|
112
|
-
|
|
113
|
-
## Constructors
|
|
114
|
-
|
|
115
|
-
### Constructor
|
|
116
|
-
|
|
117
|
-
```ts
|
|
118
|
-
new PlayerActor<TMachine>(
|
|
119
|
-
machine,
|
|
120
|
-
options,
|
|
121
|
-
input?,
|
|
122
|
-
restoredSnapshot?): PlayerActor<TMachine>;
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
Defined in: [packages/play-xstate/src/player-actor.ts:360](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.2.0/packages/play-xstate/src/player-actor.ts#L360)
|
|
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
|
-
[`AbstractActor`](../../play-actor/classes/AbstractActor.md).[`constructor`](../../play-actor/classes/AbstractActor.md#constructor)
|
|
143
|
-
|
|
144
|
-
## Properties
|
|
145
|
-
|
|
146
|
-
| Property | Modifier | Type | Description | Overrides | Inherited from | Defined in |
|
|
147
|
-
| ------------------------------------------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
148
|
-
| <a id="property-_parent"></a> `_parent?` | `public` | [`AnyActorRef`](https://www.jsdocs.io/package/xstate#AnyActorRef) | - | - | [`AbstractActor`](../../play-actor/classes/AbstractActor.md).[`_parent`](../../play-actor/classes/AbstractActor.md#property-_parent) | - |
|
|
149
|
-
| <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. | - | [`AbstractActor`](../../play-actor/classes/AbstractActor.md).[`clock`](../../play-actor/classes/AbstractActor.md#property-clock) | - |
|
|
150
|
-
| <a id="property-currentroute"></a> `currentRoute` | `public` | [`Computed`](../../play-signals/namespaces/Signal/classes/Computed.md)\<`string` \| `null`\> | A TC39 `Signal.Computed`. It derives the current URL path from the `meta.route` template of the active machine state and from the context of the actor. It returns `null` when the current state has no `meta.route` field, and also when it cannot resolve the complete route template. A necessary `:param` that the context does not hold is caught inside the signal, and a `MissingRouteParamError` therefore never leaves `get()`: that condition is temporary during a transition, and the signal computes the value again on the next snapshot. **Example** `// It returns "/profile/alice" when context.params.userId === "alice", // and null while the param is still absent. const route = actor.currentRoute.get();` | - | - | [packages/play-xstate/src/player-actor.ts:304](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.2.0/packages/play-xstate/src/player-actor.ts#L304) |
|
|
151
|
-
| <a id="property-currentview"></a> `currentView` | `readonly` | [`State`](../../play-signals/namespaces/Signal/classes/State.md)\<[`PlaySpec`](../../play-actor/interfaces/PlaySpec.md) \| `null`\> | The reactive signal of the current view spec. The signal derives the spec from the `meta.view` metadata of the active state. It emits a **new object reference** on each real change of the view on the screen: the view of a different state, or a change of a param or of the context that changes the resolved spec. A re-entry with `reenter: true` and new params also changes the spec. A snapshot that changes no view on the screen, such as an assign of the context alone, keeps the previous reference. A provider below the signal therefore mounts the UI again not on every event. The `PlaySpec` of the emission carries the context of the machine in its composed `state` field, under the read-only `/context` subtree. A spec therefore reads the context, and also each URL param, through the ordinary state grammar (`{ $state: "/context/params/section" }`). The context-projection module of `@xmachines/play-actor` holds the complete contract. The signal returns `null` when the current state has no `meta.view` metadata. Two states can declare two separate `meta.view` literals with an identical structure. A transition between those two states then emits two different references, and a provider mounts the UI again. Move the shared literal into one `typedSpec` constant, and the identity then removes the duplicate. **Example** `const view = actor.currentView.get(); if (view) { console.log(view.root); // for example "root" console.log(view.elements); // the Spec elements of @xmachines/json-render-core }` | - | - | [packages/play-xstate/src/player-actor.ts:358](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.2.0/packages/play-xstate/src/player-actor.ts#L358) |
|
|
152
|
-
| <a id="property-id"></a> `id` | `public` | `string` | The unique identifier for this actor relative to its parent. | - | [`AbstractActor`](../../play-actor/classes/AbstractActor.md).[`id`](../../play-actor/classes/AbstractActor.md#property-id) | - |
|
|
153
|
-
| <a id="property-initialroute"></a> `initialRoute` | `readonly` | `string` \| `null` | The route of the initial state of the machine. The constructor fixes it, and it never changes, also when the code restores the actor from a snapshot. A router bridge compares it with the browser URL, and it therefore separates a deep link (a URL that is not the initial one → the router wins) from a restore (the initial URL, and the actor at a different route from the restore → the actor wins). `deriveInitialRoute` derives the value statically from the machine definition, with the pure `initialTransition` helper of XState: the chain of the initial states and their `meta.route` templates are fixed at the moment of the machine definition, and the substitution of a `:param` uses the real initial context of the machine for the `input` of this actor. The code makes no second actor, and a snapshot of a restore changes the value never: it is always the **default** initial route of the machine. | - | - | [packages/play-xstate/src/player-actor.ts:323](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.2.0/packages/play-xstate/src/player-actor.ts#L323) |
|
|
154
|
-
| <a id="property-logic"></a> `logic` | `public` | [`AnyActorLogic`](https://www.jsdocs.io/package/xstate#AnyActorLogic) | - | - | [`AbstractActor`](../../play-actor/classes/AbstractActor.md).[`logic`](../../play-actor/classes/AbstractActor.md#property-logic) | - |
|
|
155
|
-
| <a id="property-options"></a> `options` | `public` | `Readonly`\<[`ActorOptions`](https://www.jsdocs.io/package/xstate#ActorOptions)\<`TLogic`\>\> | - | - | [`AbstractActor`](../../play-actor/classes/AbstractActor.md).[`options`](../../play-actor/classes/AbstractActor.md#property-options) | - |
|
|
156
|
-
| <a id="property-ref"></a> `ref` | `public` | [`ActorRef`](https://www.jsdocs.io/package/xstate#ActorRef)\<`any`, `any`, `any`\> | - | - | [`AbstractActor`](../../play-actor/classes/AbstractActor.md).[`ref`](../../play-actor/classes/AbstractActor.md#property-ref) | - |
|
|
157
|
-
| <a id="property-sessionid"></a> `sessionId` | `public` | `string` | The globally unique process ID for this invocation. | - | [`AbstractActor`](../../play-actor/classes/AbstractActor.md).[`sessionId`](../../play-actor/classes/AbstractActor.md#property-sessionid) | - |
|
|
158
|
-
| <a id="property-src"></a> `src` | `public` | \| `string` \| [`AnyActorLogic`](https://www.jsdocs.io/package/xstate#AnyActorLogic) | - | - | [`AbstractActor`](../../play-actor/classes/AbstractActor.md).[`src`](../../play-actor/classes/AbstractActor.md#property-src) | - |
|
|
159
|
-
| <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. | [`AbstractActor`](../../play-actor/classes/AbstractActor.md).[`state`](../../play-actor/classes/AbstractActor.md#property-state) | - | [packages/play-xstate/src/player-actor.ts:263](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.2.0/packages/play-xstate/src/player-actor.ts#L263) |
|
|
160
|
-
| <a id="property-system"></a> `system` | `public` | [`AnyActorSystem`](https://www.jsdocs.io/package/xstate#AnyActorSystem) | The system to which this actor belongs. | - | [`AbstractActor`](../../play-actor/classes/AbstractActor.md).[`system`](../../play-actor/classes/AbstractActor.md#property-system) | - |
|
|
161
|
-
| <a id="property-systemid"></a> `systemId` | `public` | `string` \| `undefined` | - | - | [`AbstractActor`](../../play-actor/classes/AbstractActor.md).[`systemId`](../../play-actor/classes/AbstractActor.md#property-systemid) | - |
|
|
162
|
-
|
|
163
|
-
## Methods
|
|
164
|
-
|
|
165
|
-
### \[observable\]()
|
|
166
|
-
|
|
167
|
-
```ts
|
|
168
|
-
observable: InteropSubscribable<any>;
|
|
169
|
-
```
|
|
170
|
-
|
|
171
|
-
Defined in: `xstate`
|
|
172
|
-
|
|
173
|
-
#### Returns
|
|
174
|
-
|
|
175
|
-
[`InteropSubscribable`](https://www.jsdocs.io/package/xstate#InteropSubscribable)\<`any`\>
|
|
176
|
-
|
|
177
|
-
#### Inherited from
|
|
178
|
-
|
|
179
|
-
[`AbstractActor`](../../play-actor/classes/AbstractActor.md).[`[observable]`](../../play-actor/classes/AbstractActor.md#observable)
|
|
180
|
-
|
|
181
|
-
---
|
|
182
|
-
|
|
183
|
-
### can()
|
|
184
|
-
|
|
185
|
-
```ts
|
|
186
|
-
can(event): boolean;
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
Defined in: [packages/play-xstate/src/player-actor.ts:276](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.2.0/packages/play-xstate/src/player-actor.ts#L276)
|
|
190
|
-
|
|
191
|
-
Tells you if the current state of the actor accepts the given event.
|
|
192
|
-
|
|
193
|
-
The type is the event union of the machine. An unknown event type is therefore a
|
|
194
|
-
compile error. The method evaluates the event against the snapshot signal.
|
|
195
|
-
|
|
196
|
-
#### Parameters
|
|
197
|
-
|
|
198
|
-
| Parameter | Type |
|
|
199
|
-
| --------- | ------------------------------------------------------------------------------------- |
|
|
200
|
-
| `event` | [`EventFromLogic`](https://www.jsdocs.io/package/xstate#EventFromLogic)\<`TMachine`\> |
|
|
201
|
-
|
|
202
|
-
#### Returns
|
|
203
|
-
|
|
204
|
-
`boolean`
|
|
205
|
-
|
|
206
|
-
#### Example
|
|
207
|
-
|
|
208
|
-
```typescript
|
|
209
|
-
if (actor.can({ type: "auth.logout" })) { ... }
|
|
210
|
-
```
|
|
211
|
-
|
|
212
|
-
---
|
|
213
|
-
|
|
214
|
-
### ~~dispose()~~
|
|
215
|
-
|
|
216
|
-
```ts
|
|
217
|
-
dispose(): void;
|
|
218
|
-
```
|
|
219
|
-
|
|
220
|
-
Defined in: [packages/play-xstate/src/player-actor.ts:751](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.2.0/packages/play-xstate/src/player-actor.ts#L751)
|
|
221
|
-
|
|
222
|
-
The dispose method, for the cleanup. It is the alias of [stop](#stop).
|
|
223
|
-
|
|
224
|
-
#### Returns
|
|
225
|
-
|
|
226
|
-
`void`
|
|
227
|
-
|
|
228
|
-
#### Deprecated
|
|
229
|
-
|
|
230
|
-
Use [stop](#stop). Will be removed in the next major.
|
|
231
|
-
|
|
232
|
-
---
|
|
233
|
-
|
|
234
|
-
### getPersistedSnapshot()
|
|
235
|
-
|
|
236
|
-
```ts
|
|
237
|
-
getPersistedSnapshot(options?): Snapshot<unknown>;
|
|
238
|
-
```
|
|
239
|
-
|
|
240
|
-
Defined in: [packages/play-xstate/src/player-actor.ts:696](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.2.0/packages/play-xstate/src/player-actor.ts#L696)
|
|
241
|
-
|
|
242
|
-
Returns the persisted snapshot of this actor.
|
|
243
|
-
|
|
244
|
-
Use it to serialize the state, and to restore it later with the
|
|
245
|
-
`restore.snapshot` option of the factory.
|
|
246
|
-
|
|
247
|
-
#### Parameters
|
|
248
|
-
|
|
249
|
-
| Parameter | Type |
|
|
250
|
-
| ---------- | --------- |
|
|
251
|
-
| `options?` | `unknown` |
|
|
252
|
-
|
|
253
|
-
#### Returns
|
|
254
|
-
|
|
255
|
-
[`Snapshot`](https://www.jsdocs.io/package/xstate#Snapshot)\<`unknown`\>
|
|
256
|
-
|
|
257
|
-
#### Overrides
|
|
258
|
-
|
|
259
|
-
[`AbstractActor`](../../play-actor/classes/AbstractActor.md).[`getPersistedSnapshot`](../../play-actor/classes/AbstractActor.md#getpersistedsnapshot)
|
|
260
|
-
|
|
261
|
-
---
|
|
262
|
-
|
|
263
|
-
### getSnapshot()
|
|
264
|
-
|
|
265
|
-
```ts
|
|
266
|
-
getSnapshot(): SnapshotFrom<TMachine>;
|
|
267
|
-
```
|
|
268
|
-
|
|
269
|
-
Defined in: [packages/play-xstate/src/player-actor.ts:595](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.2.0/packages/play-xstate/src/player-actor.ts#L595)
|
|
270
|
-
|
|
271
|
-
Returns the current snapshot
|
|
272
|
-
|
|
273
|
-
#### Returns
|
|
274
|
-
|
|
275
|
-
[`SnapshotFrom`](https://www.jsdocs.io/package/xstate#SnapshotFrom)\<`TMachine`\>
|
|
276
|
-
|
|
277
|
-
#### Overrides
|
|
278
|
-
|
|
279
|
-
[`AbstractActor`](../../play-actor/classes/AbstractActor.md).[`getSnapshot`](../../play-actor/classes/AbstractActor.md#getsnapshot)
|
|
280
|
-
|
|
281
|
-
---
|
|
282
|
-
|
|
283
|
-
### on()
|
|
284
|
-
|
|
285
|
-
```ts
|
|
286
|
-
on<TType>(type, handler): Subscription;
|
|
287
|
-
```
|
|
288
|
-
|
|
289
|
-
Defined in: [packages/play-xstate/src/player-actor.ts:681](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.2.0/packages/play-xstate/src/player-actor.ts#L681)
|
|
290
|
-
|
|
291
|
-
Listens for the events that this actor emits with the `emit` action.
|
|
292
|
-
|
|
293
|
-
#### Type Parameters
|
|
294
|
-
|
|
295
|
-
| Type Parameter |
|
|
296
|
-
| ----------------------- |
|
|
297
|
-
| `TType` _extends_ `any` |
|
|
298
|
-
|
|
299
|
-
#### Parameters
|
|
300
|
-
|
|
301
|
-
| Parameter | Type | Description |
|
|
302
|
-
| --------- | --------------------- | ---------------------------------------------------------------------- |
|
|
303
|
-
| `type` | `TType` | The type of the emitted event to listen for, or `"*"` for every event. |
|
|
304
|
-
| `handler` | (`emitted`) => `void` | The actor calls it with each emitted event that matches. |
|
|
305
|
-
|
|
306
|
-
#### Returns
|
|
307
|
-
|
|
308
|
-
[`Subscription`](https://www.jsdocs.io/package/xstate#Subscription)
|
|
309
|
-
|
|
310
|
-
The subscription, with an `unsubscribe()` method.
|
|
311
|
-
|
|
312
|
-
#### Overrides
|
|
313
|
-
|
|
314
|
-
[`AbstractActor`](../../play-actor/classes/AbstractActor.md).[`on`](../../play-actor/classes/AbstractActor.md#on)
|
|
315
|
-
|
|
316
|
-
---
|
|
317
|
-
|
|
318
|
-
### select()
|
|
319
|
-
|
|
320
|
-
```ts
|
|
321
|
-
select<TSelected>(selector, equalityFn?): Readable<TSelected>;
|
|
322
|
-
```
|
|
323
|
-
|
|
324
|
-
Defined in: `xstate`
|
|
325
|
-
|
|
326
|
-
#### Type Parameters
|
|
327
|
-
|
|
328
|
-
| Type Parameter |
|
|
329
|
-
| -------------- |
|
|
330
|
-
| `TSelected` |
|
|
331
|
-
|
|
332
|
-
#### Parameters
|
|
333
|
-
|
|
334
|
-
| Parameter | Type |
|
|
335
|
-
| ------------- | --------------------------- |
|
|
336
|
-
| `selector` | (`snapshot`) => `TSelected` |
|
|
337
|
-
| `equalityFn?` | (`a`, `b`) => `boolean` |
|
|
338
|
-
|
|
339
|
-
#### Returns
|
|
340
|
-
|
|
341
|
-
`Readable`\<`TSelected`\>
|
|
342
|
-
|
|
343
|
-
#### Inherited from
|
|
344
|
-
|
|
345
|
-
[`AbstractActor`](../../play-actor/classes/AbstractActor.md).[`select`](../../play-actor/classes/AbstractActor.md#select)
|
|
346
|
-
|
|
347
|
-
---
|
|
348
|
-
|
|
349
|
-
### send()
|
|
350
|
-
|
|
351
|
-
```ts
|
|
352
|
-
send(event): void;
|
|
353
|
-
```
|
|
354
|
-
|
|
355
|
-
Defined in: [packages/play-xstate/src/player-actor.ts:556](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.2.0/packages/play-xstate/src/player-actor.ts#L556)
|
|
356
|
-
|
|
357
|
-
Sends an event to this actor.
|
|
358
|
-
|
|
359
|
-
The guards of the state machine of the actor decide if the event causes a
|
|
360
|
-
transition. Give any event of the event union of the machine: a domain event, a
|
|
361
|
-
routing event, and so on.
|
|
362
|
-
|
|
363
|
-
#### Parameters
|
|
364
|
-
|
|
365
|
-
| Parameter | Type | Description |
|
|
366
|
-
| --------- | ------------------------------------------------------------------------------------- | ---------------------------------------------------------------- |
|
|
367
|
-
| `event` | [`EventFromLogic`](https://www.jsdocs.io/package/xstate#EventFromLogic)\<`TMachine`\> | An event of the `EventFromLogic<TMachine>` union of the machine. |
|
|
368
|
-
|
|
369
|
-
#### Returns
|
|
370
|
-
|
|
371
|
-
`void`
|
|
372
|
-
|
|
373
|
-
#### Throws
|
|
374
|
-
|
|
375
|
-
When `event` is not a plain object, for example
|
|
376
|
-
`null`, `undefined`, a string, or a number. Import the class from
|
|
377
|
-
`@xmachines/play-xstate/errors`.
|
|
378
|
-
|
|
379
|
-
#### Example
|
|
380
|
-
|
|
381
|
-
```typescript
|
|
382
|
-
// A domain event, with the type of the event union of the machine
|
|
383
|
-
actor.send({ type: "auth.login", userId: "123" });
|
|
384
|
-
|
|
385
|
-
// A routing event
|
|
386
|
-
actor.send({ type: "play.route", to: "#home" });
|
|
387
|
-
```
|
|
388
|
-
|
|
389
|
-
#### Overrides
|
|
390
|
-
|
|
391
|
-
[`AbstractActor`](../../play-actor/classes/AbstractActor.md).[`send`](../../play-actor/classes/AbstractActor.md#send)
|
|
392
|
-
|
|
393
|
-
---
|
|
394
|
-
|
|
395
|
-
### start()
|
|
396
|
-
|
|
397
|
-
```ts
|
|
398
|
-
start(): this;
|
|
399
|
-
```
|
|
400
|
-
|
|
401
|
-
Defined in: [packages/play-xstate/src/player-actor.ts:482](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.2.0/packages/play-xstate/src/player-actor.ts#L482)
|
|
402
|
-
|
|
403
|
-
Starts the actor.
|
|
404
|
-
|
|
405
|
-
The method fires `onStart` on each real start, which is every transition from
|
|
406
|
-
"not running" to "running". A start after a stop is such a transition, and XState
|
|
407
|
-
permits it: its own `start()` stops only while the actor RUNS already. A second
|
|
408
|
-
call while the actor runs fires no hook. Therefore a defensive double mount runs
|
|
409
|
-
the side effects of `onStart` one time for one real start.
|
|
410
|
-
|
|
411
|
-
#### Returns
|
|
412
|
-
|
|
413
|
-
`this`
|
|
414
|
-
|
|
415
|
-
#### Overrides
|
|
416
|
-
|
|
417
|
-
[`AbstractActor`](../../play-actor/classes/AbstractActor.md).[`start`](../../play-actor/classes/AbstractActor.md#start)
|
|
418
|
-
|
|
419
|
-
---
|
|
420
|
-
|
|
421
|
-
### stop()
|
|
422
|
-
|
|
423
|
-
```ts
|
|
424
|
-
stop(): this;
|
|
425
|
-
```
|
|
426
|
-
|
|
427
|
-
Defined in: [packages/play-xstate/src/player-actor.ts:512](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.2.0/packages/play-xstate/src/player-actor.ts#L512)
|
|
428
|
-
|
|
429
|
-
Stops the actor and cleans up.
|
|
430
|
-
|
|
431
|
-
The method fires `onStop` only when the actor ran. This matches XState, where a
|
|
432
|
-
stop of an actor that never started, or of an actor that stopped already, does
|
|
433
|
-
nothing and tears nothing down. Therefore the paired cleanup runs never two
|
|
434
|
-
times, and it runs never against a resource that `onStart` did not take. A stop
|
|
435
|
-
does not close the actor for ever: a later `start()` is a new lifecycle, and it
|
|
436
|
-
fires `onStart` again.
|
|
437
|
-
|
|
438
|
-
#### Returns
|
|
439
|
-
|
|
440
|
-
`this`
|
|
441
|
-
|
|
442
|
-
#### Overrides
|
|
443
|
-
|
|
444
|
-
[`AbstractActor`](../../play-actor/classes/AbstractActor.md).[`stop`](../../play-actor/classes/AbstractActor.md#stop)
|
|
445
|
-
|
|
446
|
-
---
|
|
447
|
-
|
|
448
|
-
### subscribe()
|
|
449
|
-
|
|
450
|
-
#### Call Signature
|
|
451
|
-
|
|
452
|
-
```ts
|
|
453
|
-
subscribe(observer): Subscription;
|
|
454
|
-
```
|
|
455
|
-
|
|
456
|
-
Defined in: [packages/play-xstate/src/player-actor.ts:618](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.2.0/packages/play-xstate/src/player-actor.ts#L618)
|
|
457
|
-
|
|
458
|
-
Subscribes to the snapshot updates of this actor.
|
|
459
|
-
|
|
460
|
-
The method accepts an observer object, exactly like `Actor.subscribe` of XState.
|
|
461
|
-
|
|
462
|
-
##### Parameters
|
|
463
|
-
|
|
464
|
-
| Parameter | Type | Description |
|
|
465
|
-
| ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------ |
|
|
466
|
-
| `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. |
|
|
467
|
-
|
|
468
|
-
##### Returns
|
|
469
|
-
|
|
470
|
-
[`Subscription`](https://www.jsdocs.io/package/xstate#Subscription)
|
|
471
|
-
|
|
472
|
-
The subscription, with an `unsubscribe()` method.
|
|
473
|
-
|
|
474
|
-
##### Overrides
|
|
475
|
-
|
|
476
|
-
[`AbstractActor`](../../play-actor/classes/AbstractActor.md).[`subscribe`](../../play-actor/classes/AbstractActor.md#subscribe)
|
|
477
|
-
|
|
478
|
-
#### Call Signature
|
|
479
|
-
|
|
480
|
-
```ts
|
|
481
|
-
subscribe(
|
|
482
|
-
nextListener?,
|
|
483
|
-
errorListener?,
|
|
484
|
-
completeListener?): Subscription;
|
|
485
|
-
```
|
|
486
|
-
|
|
487
|
-
Defined in: [packages/play-xstate/src/player-actor.ts:629](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.2.0/packages/play-xstate/src/player-actor.ts#L629)
|
|
488
|
-
|
|
489
|
-
Subscribes to the snapshot updates of this actor.
|
|
490
|
-
|
|
491
|
-
The method accepts listener functions, exactly like `Actor.subscribe` of XState.
|
|
492
|
-
|
|
493
|
-
##### Parameters
|
|
494
|
-
|
|
495
|
-
| Parameter | Type | Description |
|
|
496
|
-
| ------------------- | ---------------------- | -------------------------------------------------------------------------------- |
|
|
497
|
-
| `nextListener?` | (`snapshot`) => `void` | The listener function of each snapshot. |
|
|
498
|
-
| `errorListener?` | (`error`) => `void` | The actor calls it on an error. |
|
|
499
|
-
| `completeListener?` | () => `void` | The actor calls it when it completes, which means that it reaches a final state. |
|
|
500
|
-
|
|
501
|
-
##### Returns
|
|
502
|
-
|
|
503
|
-
[`Subscription`](https://www.jsdocs.io/package/xstate#Subscription)
|
|
504
|
-
|
|
505
|
-
The subscription, with an `unsubscribe()` method.
|
|
506
|
-
|
|
507
|
-
##### Overrides
|
|
508
|
-
|
|
509
|
-
[`AbstractActor`](../../play-actor/classes/AbstractActor.md).[`subscribe`](../../play-actor/classes/AbstractActor.md#subscribe)
|
|
510
|
-
|
|
511
|
-
---
|
|
512
|
-
|
|
513
|
-
### toJSON()
|
|
514
|
-
|
|
515
|
-
```ts
|
|
516
|
-
toJSON(): object;
|
|
517
|
-
```
|
|
518
|
-
|
|
519
|
-
Defined in: `xstate`
|
|
520
|
-
|
|
521
|
-
#### Returns
|
|
522
|
-
|
|
523
|
-
`object`
|
|
524
|
-
|
|
525
|
-
| Name | Type | Defined in |
|
|
526
|
-
| -------------- | -------- | ---------- |
|
|
527
|
-
| `id` | `string` | - |
|
|
528
|
-
| `xstate$$type` | `number` | - |
|
|
529
|
-
|
|
530
|
-
#### Inherited from
|
|
531
|
-
|
|
532
|
-
[`AbstractActor`](../../play-actor/classes/AbstractActor.md).[`toJSON`](../../play-actor/classes/AbstractActor.md#tojson)
|