@rbxts/tether 1.4.0 → 1.4.2
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 +1 -1
- package/out/emitters/client-emitter.d.ts +49 -0
- package/out/emitters/client-emitter.luau +156 -0
- package/out/emitters/contextual-emitter.d.ts +26 -0
- package/out/emitters/contextual-emitter.luau +49 -0
- package/out/emitters/message-emitter.d.ts +41 -0
- package/out/emitters/message-emitter.luau +222 -0
- package/out/emitters/server-emitter.d.ts +30 -0
- package/out/emitters/server-emitter.luau +107 -0
- package/out/index.d.ts +1 -1
- package/out/init.luau +1 -1
- package/out/logging.d.ts +15 -0
- package/out/logging.luau +4 -0
- package/out/relayer.d.ts +16 -0
- package/out/relayer.luau +214 -0
- package/out/serdes.d.ts +13 -0
- package/out/serdes.luau +58 -0
- package/out/structs.d.ts +3 -2
- package/out/utility.d.ts +12 -0
- package/out/utility.luau +74 -0
- package/package.json +1 -1
- package/out/message-emitter.d.ts +0 -128
- package/out/message-emitter.luau +0 -792
package/out/message-emitter.d.ts
DELETED
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
import { Modding } from "@flamework/core";
|
|
2
|
-
import Destroyable from "@rbxts/destroyable";
|
|
3
|
-
import { MiddlewareProvider } from "./middleware";
|
|
4
|
-
import type { ClientMessageCallback, ServerMessageCallback, BaseMessage, MessageEmitterMetadata, ClientMessageFunctionCallback, ServerMessageFunctionCallback } from "./structs";
|
|
5
|
-
interface MessageEmitterOptions {
|
|
6
|
-
readonly batchRemotes: boolean;
|
|
7
|
-
readonly batchRate: number;
|
|
8
|
-
}
|
|
9
|
-
export declare class MessageEmitter<MessageData> extends Destroyable {
|
|
10
|
-
private readonly options;
|
|
11
|
-
readonly middleware: MiddlewareProvider<MessageData>;
|
|
12
|
-
private readonly guards;
|
|
13
|
-
private serializers;
|
|
14
|
-
private clientCallbacks;
|
|
15
|
-
private clientFunctions;
|
|
16
|
-
private serverCallbacks;
|
|
17
|
-
private serverFunctions;
|
|
18
|
-
private serverQueue;
|
|
19
|
-
private clientBroadcastQueue;
|
|
20
|
-
private clientQueue;
|
|
21
|
-
/** @metadata macro */
|
|
22
|
-
static create<MessageData>(options?: Partial<MessageEmitterOptions>, meta?: Modding.Many<MessageEmitterMetadata<MessageData>>): MessageEmitter<MessageData>;
|
|
23
|
-
private constructor();
|
|
24
|
-
readonly server: {
|
|
25
|
-
/**
|
|
26
|
-
* @returns A destructor function that disconnects the callback from the message
|
|
27
|
-
*/
|
|
28
|
-
on: <Kind extends keyof MessageData>(message: Kind & BaseMessage, callback: ServerMessageCallback<MessageData[Kind]>) => () => void;
|
|
29
|
-
/**
|
|
30
|
-
* Disconnects the callback as soon as it is called for the first time
|
|
31
|
-
*
|
|
32
|
-
* @returns A destructor function that disconnects the callback from the message
|
|
33
|
-
*/
|
|
34
|
-
once: <Kind extends keyof MessageData>(message: Kind & BaseMessage, callback: ServerMessageCallback<MessageData[Kind]>) => () => void;
|
|
35
|
-
/**
|
|
36
|
-
* Emits a message to the server
|
|
37
|
-
*
|
|
38
|
-
* @param message The message kind to be sent
|
|
39
|
-
* @param data The data associated with the message
|
|
40
|
-
* @param unreliable Whether the message should be sent unreliably
|
|
41
|
-
*/
|
|
42
|
-
emit: <Kind extends keyof MessageData>(message: Kind & BaseMessage, data?: MessageData[Kind], unreliable?: boolean) => void;
|
|
43
|
-
/**
|
|
44
|
-
* Simulates a remote function invocation.
|
|
45
|
-
*
|
|
46
|
-
* @param message The message kind to be sent
|
|
47
|
-
* @param data The data associated with the message
|
|
48
|
-
* @param unreliable Whether the message should be sent unreliably
|
|
49
|
-
*/
|
|
50
|
-
invoke: <Kind extends keyof MessageData, ReturnKind extends keyof MessageData>(message: Kind & BaseMessage, returnMessage: ReturnKind & BaseMessage, data?: MessageData[Kind], unreliable?: boolean) => Promise<MessageData[ReturnKind]>;
|
|
51
|
-
/**
|
|
52
|
-
* Sets a callback for a simulated remote function
|
|
53
|
-
*
|
|
54
|
-
* @returns A destructor function that disconnects the callback from the message
|
|
55
|
-
*/
|
|
56
|
-
setCallback: <Kind extends keyof MessageData, ReturnKind extends keyof MessageData>(message: Kind & BaseMessage, returnMessage: ReturnKind & BaseMessage, callback: ServerMessageFunctionCallback<MessageData[Kind], MessageData[ReturnKind]>) => () => void;
|
|
57
|
-
};
|
|
58
|
-
readonly client: {
|
|
59
|
-
/**
|
|
60
|
-
* @returns A destructor function that disconnects the callback from the message
|
|
61
|
-
*/
|
|
62
|
-
on: <Kind extends keyof MessageData>(message: Kind & BaseMessage, callback: ClientMessageCallback<MessageData[Kind]>) => () => void;
|
|
63
|
-
/**
|
|
64
|
-
* Disconnects the callback as soon as it is called for the first time
|
|
65
|
-
*
|
|
66
|
-
* @returns A destructor function that disconnects the callback from the message
|
|
67
|
-
*/
|
|
68
|
-
once: <Kind extends keyof MessageData>(message: Kind & BaseMessage, callback: ClientMessageCallback<MessageData[Kind]>) => () => void;
|
|
69
|
-
/**
|
|
70
|
-
* Emits a message to a specific client or multiple clients
|
|
71
|
-
*
|
|
72
|
-
* @param player The player(s) to whom the message is sent
|
|
73
|
-
* @param message The message kind to be sent
|
|
74
|
-
* @param data The data associated with the message
|
|
75
|
-
* @param unreliable Whether the message should be sent unreliably
|
|
76
|
-
*/
|
|
77
|
-
emit: <Kind extends keyof MessageData>(player: Player | Player[], message: Kind & BaseMessage, data?: MessageData[Kind], unreliable?: boolean) => void;
|
|
78
|
-
/**
|
|
79
|
-
* Emits a message to all clients except the specified client(s)
|
|
80
|
-
*
|
|
81
|
-
* @param player The player(s) to whom the message is not sent
|
|
82
|
-
* @param message The message kind to be sent
|
|
83
|
-
* @param data The data associated with the message
|
|
84
|
-
* @param unreliable Whether the message should be sent unreliably
|
|
85
|
-
*/
|
|
86
|
-
emitExcept: <Kind extends keyof MessageData>(player: Player | Player[], message: Kind & BaseMessage, data?: MessageData[Kind], unreliable?: boolean) => void;
|
|
87
|
-
/**
|
|
88
|
-
* Emits a message to all connected clients
|
|
89
|
-
*
|
|
90
|
-
* @param message The message kind to be sent
|
|
91
|
-
* @param data The data associated with the message
|
|
92
|
-
* @param unreliable Whether the message should be sent unreliably
|
|
93
|
-
*/
|
|
94
|
-
emitAll: <Kind extends keyof MessageData>(message: Kind & BaseMessage, data?: MessageData[Kind], unreliable?: boolean) => void;
|
|
95
|
-
/**
|
|
96
|
-
* Simulates a remote function invocation.
|
|
97
|
-
*
|
|
98
|
-
* @param message The message kind to be sent
|
|
99
|
-
* @param data The data associated with the message
|
|
100
|
-
* @param unreliable Whether the message should be sent unreliably
|
|
101
|
-
*/
|
|
102
|
-
invoke: <Kind extends keyof MessageData, ReturnKind extends keyof MessageData>(message: Kind & BaseMessage, returnMessage: ReturnKind & BaseMessage, player: Player, data?: MessageData[Kind], unreliable?: boolean) => Promise<MessageData[ReturnKind]>;
|
|
103
|
-
/**
|
|
104
|
-
* Sets a callback for a simulated remote function
|
|
105
|
-
*
|
|
106
|
-
* @returns A destructor function that disconnects the callback from the message
|
|
107
|
-
*/
|
|
108
|
-
setCallback: <Kind extends keyof MessageData, ReturnKind extends keyof MessageData>(message: Kind & BaseMessage, returnMessage: ReturnKind & BaseMessage, callback: ClientMessageFunctionCallback<MessageData[Kind], MessageData[ReturnKind]>) => () => void;
|
|
109
|
-
};
|
|
110
|
-
private initialize;
|
|
111
|
-
private update;
|
|
112
|
-
private runClientMiddlewares;
|
|
113
|
-
private runServerMiddlewares;
|
|
114
|
-
private validateData;
|
|
115
|
-
private onRemoteFire;
|
|
116
|
-
private executeFunctions;
|
|
117
|
-
private executeEventCallbacks;
|
|
118
|
-
private deserializeAndValidate;
|
|
119
|
-
private once;
|
|
120
|
-
private on;
|
|
121
|
-
private getPacket;
|
|
122
|
-
/** @metadata macro */
|
|
123
|
-
private addSerializer;
|
|
124
|
-
/** @metadata macro */
|
|
125
|
-
private createMessageSerializer;
|
|
126
|
-
private getSerializer;
|
|
127
|
-
}
|
|
128
|
-
export {};
|