@rbxts/reflex-class
Advanced tools
Comparing version 1.0.4 to 1.0.5
@@ -1,3 +0,58 @@ | ||
import { BroadcasterOptions, ProducerMap, ProducerMiddleware } from "@rbxts/reflex"; | ||
export declare const CreatePatchBroadcaster: <P extends ProducerMap>(options: BroadcasterOptions<P>) => { | ||
/// <reference types="@rbxts/types" /> | ||
/// <reference types="@rbxts/compiler-types" /> | ||
import { BroadcastAction, Producer, ProducerMiddleware } from "@rbxts/reflex"; | ||
interface PatchBroadcasterOptions<S extends object> { | ||
/** | ||
* The map of producers to broadcast. | ||
*/ | ||
readonly producer: Producer<S>; | ||
/** | ||
* The rate at which the server should hydrate the clients | ||
* with the latest state. If this is set to `-1`, the server | ||
* will not hydrate the clients. | ||
* @default 60 | ||
*/ | ||
readonly hydrateRate?: number; | ||
/** | ||
* The rate at which the server should broadcast actions to | ||
* the clients. If this is set to `0`, actions are broadcast | ||
* with the next server heartbeat. | ||
* @default 0 | ||
*/ | ||
readonly dispatchRate?: number; | ||
/** | ||
* Runs before actions are dispatched to a player. Can be used to | ||
* filter actions or manipulate them before sending. | ||
* | ||
* Return `undefined` to not share the action with this player. | ||
*/ | ||
readonly beforeDispatch?: (player: Player, action: BroadcastAction) => BroadcastAction | undefined; | ||
/** | ||
* Runs before the client is hydrated with the latest state. Can be | ||
* used to filter the state or hide certain values from the client. | ||
* | ||
* **Note:** Do not mutate the state in this function! Treat it as a | ||
* read-only object, and return a new object if you need to change it. | ||
*/ | ||
readonly beforeHydrate?: (player: Player, state: S) => Partial<S>; | ||
/** | ||
* A function that broadcasts actions to the given player. | ||
* @param player The player to broadcast to. | ||
* @param actions The actions to broadcast. | ||
*/ | ||
readonly dispatch: (player: Player, actions: BroadcastAction[]) => void; | ||
/** | ||
* An optional custom hydration function. If provided, this function | ||
* will be called instead of being implicitly handled in 'dispatch'. | ||
* Useful for reducing load on a single remote if your state is large. | ||
* | ||
* **Note:** If defined, the client should call `receiver.hydrate` to | ||
* hydrate the state. | ||
* | ||
* @param player The player to hydrate. | ||
* @param state The state to hydrate the player with. | ||
*/ | ||
readonly hydrate?: (player: Player, state: S) => void; | ||
} | ||
export declare const CreatePatchBroadcaster: <S extends object>(options: PatchBroadcasterOptions<S>) => { | ||
flush: () => void; | ||
@@ -8,1 +63,2 @@ start: (player: Player) => void; | ||
}; | ||
export {}; |
{ | ||
"name": "@rbxts/reflex-class", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "out/init.lua", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19606
135