yolkbot 0.1.1-alpha.35 → 0.1.1-alpha.36
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/package.json
CHANGED
package/src/matchmaker.js
CHANGED
|
@@ -10,11 +10,11 @@ export class Matchmaker {
|
|
|
10
10
|
proxy = null;
|
|
11
11
|
sessionId = '';
|
|
12
12
|
|
|
13
|
-
forceClose = false;
|
|
14
|
-
|
|
15
13
|
onListeners = new Map();
|
|
16
14
|
onceListeners = new Map();
|
|
17
15
|
|
|
16
|
+
#forceClose = false;
|
|
17
|
+
|
|
18
18
|
// sessionId: string, a custom session id
|
|
19
19
|
// proxy: a socks5 proxy string
|
|
20
20
|
// instance: a custom game instance
|
|
@@ -55,7 +55,7 @@ export class Matchmaker {
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
this.ws.onclose = () => {
|
|
58
|
-
if (this
|
|
58
|
+
if (this.#forceClose) return;
|
|
59
59
|
|
|
60
60
|
this.connected = false;
|
|
61
61
|
this.#createSocket(instance);
|
|
@@ -159,7 +159,7 @@ export class Matchmaker {
|
|
|
159
159
|
}
|
|
160
160
|
|
|
161
161
|
close() {
|
|
162
|
-
this
|
|
162
|
+
this.#forceClose = true;
|
|
163
163
|
this.ws.close();
|
|
164
164
|
}
|
|
165
165
|
|
|
@@ -40,20 +40,26 @@ type CommandSend = {
|
|
|
40
40
|
export declare class Matchmaker {
|
|
41
41
|
connected: boolean;
|
|
42
42
|
onceConnected: Function[];
|
|
43
|
+
|
|
43
44
|
proxy: string | null;
|
|
44
45
|
sessionId: string;
|
|
45
|
-
forceClose: boolean;
|
|
46
46
|
onListeners: Map<string, Function[]>;
|
|
47
47
|
onceListeners: Map<string, Function[]>;
|
|
48
48
|
|
|
49
|
+
regionList: Region[] | null;
|
|
50
|
+
ws: yolkws;
|
|
51
|
+
|
|
49
52
|
constructor(params?: MatchmakerParams);
|
|
50
53
|
|
|
51
54
|
send(msg: CommandSend): void;
|
|
52
|
-
|
|
55
|
+
|
|
53
56
|
getRegions(): Promise<Region[]>;
|
|
54
57
|
findPublicGame(params: FindGameParams): Promise<RawGameData>;
|
|
58
|
+
|
|
55
59
|
getRandomRegion(): string;
|
|
56
60
|
getRandomGameMode(): keyof typeof GameModes;
|
|
61
|
+
|
|
62
|
+
waitForConnect(): Promise<void>;
|
|
57
63
|
close(): void;
|
|
58
64
|
|
|
59
65
|
on(event: string, callback: Function): void;
|