@cybermp-community/client-types 2.4.2 → 2.5.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/dist/precomputed/classes/extend.d.ts +1 -0
- package/dist/precomputed/{events.d.ts → events/index.ts} +27 -9
- package/dist/precomputed/events/map.ts +19 -0
- package/dist/precomputed/index.ts +9 -0
- package/dist/precomputed/mp.d.ts +1 -1
- package/dist/precomputed/{voice-chat.d.ts → voice-chat.ts} +2 -0
- package/package.json +1 -1
- package/dist/precomputed/index.d.ts +0 -9
- /package/dist/precomputed/{cef.d.ts → cef.ts} +0 -0
- /package/dist/precomputed/classes/{index.d.ts → index.ts} +0 -0
- /package/dist/precomputed/{discord.d.ts → discord.ts} +0 -0
- /package/dist/precomputed/{exports.d.ts → exports.ts} +0 -0
- /package/dist/precomputed/{local-storage.d.ts → local-storage.ts} +0 -0
- /package/dist/precomputed/{meta.d.ts → meta.ts} +0 -0
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { MpEventsMap } from "./map";
|
|
2
|
+
|
|
1
3
|
type Args = any[];
|
|
2
4
|
|
|
3
5
|
export interface MpEvents {
|
|
@@ -6,14 +8,22 @@ export interface MpEvents {
|
|
|
6
8
|
* @param eventName Name of the event.
|
|
7
9
|
* @param callback Callback function.
|
|
8
10
|
*/
|
|
9
|
-
|
|
11
|
+
|
|
12
|
+
on<E extends keyof MpEventsMap>(eventName: E, callback: MpEventsMap[E]): void;
|
|
13
|
+
on<T extends unknown[] = Args>(
|
|
14
|
+
eventName: string,
|
|
15
|
+
callback: (...args: T) => void,
|
|
16
|
+
): void;
|
|
10
17
|
|
|
11
18
|
/**
|
|
12
19
|
* UnRegister a custom event listener.
|
|
13
20
|
* @param eventName Name of the event.
|
|
14
21
|
* @param callback Callback function.
|
|
15
22
|
*/
|
|
16
|
-
off<T extends
|
|
23
|
+
off<T extends unknown[] = Args>(
|
|
24
|
+
eventName: string,
|
|
25
|
+
callback: (...args: T) => void,
|
|
26
|
+
): void;
|
|
17
27
|
|
|
18
28
|
/**
|
|
19
29
|
* Emit a previously registered custom event.
|
|
@@ -21,37 +31,45 @@ export interface MpEvents {
|
|
|
21
31
|
* @param eventName Name of the event.
|
|
22
32
|
* @param args Arguments to pass.
|
|
23
33
|
*/
|
|
24
|
-
emit<T extends
|
|
34
|
+
emit<T extends unknown[] = Args>(eventName: string, ...args: T): void;
|
|
25
35
|
|
|
26
36
|
/**
|
|
27
37
|
* Register a listener for server event on client.
|
|
28
38
|
*/
|
|
29
|
-
onServer<T extends
|
|
39
|
+
onServer<T extends unknown[] = Args>(
|
|
40
|
+
eventName: string,
|
|
41
|
+
callback: (...args: T) => void,
|
|
42
|
+
): void;
|
|
30
43
|
|
|
31
44
|
/**
|
|
32
45
|
* Emit an event to the server.
|
|
33
46
|
*/
|
|
34
|
-
emitServer<T extends
|
|
47
|
+
emitServer<T extends unknown[] = Args>(eventName: string, ...args: T): void;
|
|
35
48
|
|
|
36
49
|
/**
|
|
37
50
|
* Emit an event to the cef.
|
|
38
51
|
*/
|
|
39
|
-
emitCef<T extends
|
|
52
|
+
emitCef<T extends unknown[] = Args>(eventName: string, ...args: T): void;
|
|
40
53
|
|
|
41
54
|
/**
|
|
42
55
|
* Register a custom cef event listener.
|
|
43
56
|
* @param eventName Name of the event.
|
|
44
57
|
* @param callback Callback function.
|
|
45
58
|
*/
|
|
46
|
-
onCef<T extends
|
|
59
|
+
onCef<T extends unknown[] = Args>(
|
|
60
|
+
eventName: string,
|
|
61
|
+
callback: (...args: T) => void,
|
|
62
|
+
): void;
|
|
47
63
|
|
|
48
64
|
/**
|
|
49
65
|
* Register a command in the client scope.
|
|
50
66
|
* @param commandName Command name without "/".
|
|
51
67
|
* @param callback Callback with id and args.
|
|
52
68
|
*/
|
|
53
|
-
addCommand(
|
|
69
|
+
addCommand<T extends string[] = string[]>(
|
|
54
70
|
commandName: string,
|
|
55
|
-
callback: (id: number, args:
|
|
71
|
+
callback: (id: number, args: T) => void,
|
|
56
72
|
): void;
|
|
57
73
|
}
|
|
74
|
+
|
|
75
|
+
export * from "./map";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface MpEventsMap {
|
|
2
|
+
globalMetaChange<T = any, K = T>(
|
|
3
|
+
key: string,
|
|
4
|
+
newValue: T,
|
|
5
|
+
oldValue: K,
|
|
6
|
+
): undefined | boolean;
|
|
7
|
+
playerMetaChange<T = any, K = T>(
|
|
8
|
+
netId: number,
|
|
9
|
+
key: string,
|
|
10
|
+
newValue: T,
|
|
11
|
+
oldValue: K,
|
|
12
|
+
): undefined | boolean;
|
|
13
|
+
entityMetaChange<T = any, K = T>(
|
|
14
|
+
netId: number,
|
|
15
|
+
key: string,
|
|
16
|
+
newValue: T,
|
|
17
|
+
oldValue: K,
|
|
18
|
+
): undefined | boolean;
|
|
19
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type * from './classes';
|
|
2
|
+
export type * from './cef';
|
|
3
|
+
export type * from './discord';
|
|
4
|
+
export type * from './events';
|
|
5
|
+
export type * from './game';
|
|
6
|
+
export type * from './local-storage';
|
|
7
|
+
export type * from './meta';
|
|
8
|
+
export type * from './mp';
|
|
9
|
+
export type * from './voice-chat';
|
package/dist/precomputed/mp.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { MpCef } from './cef.d.ts';
|
|
2
2
|
import type { MpDiscord } from './discord.d.ts';
|
|
3
|
-
import type { MpEvents } from './events.
|
|
3
|
+
import type { MpEvents } from './events/index.js';
|
|
4
4
|
import type { MpLocalStorage } from './local-storage.d.ts';
|
|
5
5
|
import type { MpMeta } from './meta.d.ts';
|
|
6
6
|
import type { MpVoiceChat } from './voice-chat.d.ts';
|
package/package.json
CHANGED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export type * from './classes';
|
|
2
|
-
export type * from './cef.d.ts';
|
|
3
|
-
export type * from './discord.d.ts';
|
|
4
|
-
export type * from './events.d.ts';
|
|
5
|
-
export type * from './game.d.ts';
|
|
6
|
-
export type * from './local-storage.d.ts';
|
|
7
|
-
export type * from './meta.d.ts';
|
|
8
|
-
export type * from './mp.d.ts';
|
|
9
|
-
export type * from './voice-chat.d.ts';
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|