@types/gimloader 1.6.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.
- gimloader/LICENSE +21 -0
- gimloader/README.md +15 -0
- gimloader/index.d.ts +745 -0
- gimloader/package.json +29 -0
gimloader/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Microsoft Corporation.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE
|
gimloader/README.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Installation
|
|
2
|
+
> `npm install --save @types/gimloader`
|
|
3
|
+
|
|
4
|
+
# Summary
|
|
5
|
+
This package contains type definitions for gimloader (https://github.com/Gimloader/Gimloader#readme).
|
|
6
|
+
|
|
7
|
+
# Details
|
|
8
|
+
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/gimloader.
|
|
9
|
+
|
|
10
|
+
### Additional Details
|
|
11
|
+
* Last updated: Fri, 12 Sep 2025 19:32:39 GMT
|
|
12
|
+
* Dependencies: [@types/react](https://npmjs.com/package/@types/react), [@types/react-dom](https://npmjs.com/package/@types/react-dom)
|
|
13
|
+
|
|
14
|
+
# Credits
|
|
15
|
+
These definitions were written by [TheLazySquid](https://github.com/TheLazySquid).
|
gimloader/index.d.ts
ADDED
|
@@ -0,0 +1,745 @@
|
|
|
1
|
+
declare namespace Gimloader {
|
|
2
|
+
type event = symbol | string;
|
|
3
|
+
type eventNS = string | event[];
|
|
4
|
+
|
|
5
|
+
interface ConstructorOptions {
|
|
6
|
+
/**
|
|
7
|
+
* @default false
|
|
8
|
+
* @description set this to `true` to use wildcards.
|
|
9
|
+
*/
|
|
10
|
+
wildcard?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* @default '.'
|
|
13
|
+
* @description the delimiter used to segment namespaces.
|
|
14
|
+
*/
|
|
15
|
+
delimiter?: string;
|
|
16
|
+
/**
|
|
17
|
+
* @default false
|
|
18
|
+
* @description set this to `true` if you want to emit the newListener events.
|
|
19
|
+
*/
|
|
20
|
+
newListener?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* @default false
|
|
23
|
+
* @description set this to `true` if you want to emit the removeListener events.
|
|
24
|
+
*/
|
|
25
|
+
removeListener?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* @default 10
|
|
28
|
+
* @description the maximum amount of listeners that can be assigned to an event.
|
|
29
|
+
*/
|
|
30
|
+
maxListeners?: number;
|
|
31
|
+
/**
|
|
32
|
+
* @default false
|
|
33
|
+
* @description show event name in memory leak message when more than maximum amount of listeners is assigned, default false
|
|
34
|
+
*/
|
|
35
|
+
verboseMemoryLeak?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* @default false
|
|
38
|
+
* @description disable throwing uncaughtException if an error event is emitted and it has no listeners
|
|
39
|
+
*/
|
|
40
|
+
ignoreErrors?: boolean;
|
|
41
|
+
}
|
|
42
|
+
interface ListenerFn {
|
|
43
|
+
(...values: any[]): void;
|
|
44
|
+
}
|
|
45
|
+
interface EventAndListener {
|
|
46
|
+
(event: string | string[], ...values: any[]): void;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
interface WaitForFilter {
|
|
50
|
+
(...values: any[]): boolean;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
interface WaitForOptions {
|
|
54
|
+
/**
|
|
55
|
+
* @default 0
|
|
56
|
+
*/
|
|
57
|
+
timeout: number;
|
|
58
|
+
/**
|
|
59
|
+
* @default null
|
|
60
|
+
*/
|
|
61
|
+
filter: WaitForFilter;
|
|
62
|
+
/**
|
|
63
|
+
* @default false
|
|
64
|
+
*/
|
|
65
|
+
handleError: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* @default Promise
|
|
68
|
+
*/
|
|
69
|
+
Promise: any;
|
|
70
|
+
/**
|
|
71
|
+
* @default false
|
|
72
|
+
*/
|
|
73
|
+
overload: boolean;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
interface CancelablePromise<T> extends Promise<T> {
|
|
77
|
+
cancel(reason: string): undefined;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
interface OnceOptions {
|
|
81
|
+
/**
|
|
82
|
+
* @default 0
|
|
83
|
+
*/
|
|
84
|
+
timeout: number;
|
|
85
|
+
/**
|
|
86
|
+
* @default Promise
|
|
87
|
+
*/
|
|
88
|
+
Promise: any;
|
|
89
|
+
/**
|
|
90
|
+
* @default false
|
|
91
|
+
*/
|
|
92
|
+
overload: boolean;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
interface ListenToOptions {
|
|
96
|
+
on?: { (event: event | eventNS, handler: ListenerFn): void };
|
|
97
|
+
off?: { (event: event | eventNS, handler: ListenerFn): void };
|
|
98
|
+
reducers: (event: any) => boolean | object;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
interface GeneralEventEmitter {
|
|
102
|
+
addEventListener(event: event, handler: ListenerFn): this;
|
|
103
|
+
removeEventListener(event: event, handler: ListenerFn): this;
|
|
104
|
+
addListener?(event: event, handler: ListenerFn): this;
|
|
105
|
+
removeListener?(event: event, handler: ListenerFn): this;
|
|
106
|
+
on?(event: event, handler: ListenerFn): this;
|
|
107
|
+
off?(event: event, handler: ListenerFn): this;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
interface OnOptions {
|
|
111
|
+
async?: boolean;
|
|
112
|
+
promisify?: boolean;
|
|
113
|
+
nextTick?: boolean;
|
|
114
|
+
objectify?: boolean;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
interface Listener {
|
|
118
|
+
emitter: EventEmitter2;
|
|
119
|
+
event: event | eventNS;
|
|
120
|
+
listener: ListenerFn;
|
|
121
|
+
off(): this;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
class EventEmitter2 {
|
|
125
|
+
constructor(options?: ConstructorOptions);
|
|
126
|
+
emit(event: event | eventNS, ...values: any[]): boolean;
|
|
127
|
+
emitAsync(event: event | eventNS, ...values: any[]): Promise<any[]>;
|
|
128
|
+
addListener(event: event | eventNS, listener: ListenerFn): this | Listener;
|
|
129
|
+
on(event: event | eventNS, listener: ListenerFn, options?: boolean | OnOptions): this | Listener;
|
|
130
|
+
prependListener(event: event | eventNS, listener: ListenerFn, options?: boolean | OnOptions): this | Listener;
|
|
131
|
+
once(event: event | eventNS, listener: ListenerFn, options?: true | OnOptions): this | Listener;
|
|
132
|
+
prependOnceListener(
|
|
133
|
+
event: event | eventNS,
|
|
134
|
+
listener: ListenerFn,
|
|
135
|
+
options?: boolean | OnOptions,
|
|
136
|
+
): this | Listener;
|
|
137
|
+
many(
|
|
138
|
+
event: event | eventNS,
|
|
139
|
+
timesToListen: number,
|
|
140
|
+
listener: ListenerFn,
|
|
141
|
+
options?: boolean | OnOptions,
|
|
142
|
+
): this | Listener;
|
|
143
|
+
prependMany(
|
|
144
|
+
event: event | eventNS,
|
|
145
|
+
timesToListen: number,
|
|
146
|
+
listener: ListenerFn,
|
|
147
|
+
options?: boolean | OnOptions,
|
|
148
|
+
): this | Listener;
|
|
149
|
+
onAny(listener: EventAndListener): this;
|
|
150
|
+
prependAny(listener: EventAndListener): this;
|
|
151
|
+
offAny(listener: ListenerFn): this;
|
|
152
|
+
removeListener(event: event | eventNS, listener: ListenerFn): this;
|
|
153
|
+
off(event: event | eventNS, listener: ListenerFn): this;
|
|
154
|
+
removeAllListeners(event?: event | eventNS): this;
|
|
155
|
+
setMaxListeners(n: number): void;
|
|
156
|
+
getMaxListeners(): number;
|
|
157
|
+
eventNames(nsAsArray?: boolean): (event | eventNS)[];
|
|
158
|
+
listenerCount(event?: event | eventNS): number;
|
|
159
|
+
listeners(event?: event | eventNS): ListenerFn[];
|
|
160
|
+
listenersAny(): ListenerFn[];
|
|
161
|
+
waitFor(event: event | eventNS, timeout?: number): CancelablePromise<any[]>;
|
|
162
|
+
waitFor(event: event | eventNS, filter?: WaitForFilter): CancelablePromise<any[]>;
|
|
163
|
+
waitFor(event: event | eventNS, options?: WaitForOptions): CancelablePromise<any[]>;
|
|
164
|
+
listenTo(target: GeneralEventEmitter, events: event | eventNS, options?: ListenToOptions): this;
|
|
165
|
+
listenTo(target: GeneralEventEmitter, events: event[], options?: ListenToOptions): this;
|
|
166
|
+
listenTo(target: GeneralEventEmitter, events: object, options?: ListenToOptions): this;
|
|
167
|
+
stopListeningTo(target?: GeneralEventEmitter, event?: event | eventNS): boolean;
|
|
168
|
+
hasListeners(event?: string): boolean;
|
|
169
|
+
static once(emitter: EventEmitter2, event: event | eventNS, options?: OnceOptions): CancelablePromise<any[]>;
|
|
170
|
+
static defaultMaxListeners: number;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
class PluginsApi {
|
|
174
|
+
/** A list of all the plugins installed */
|
|
175
|
+
get list(): string[];
|
|
176
|
+
/** Whether a plugin exists and is enabled */
|
|
177
|
+
isEnabled(name: string): boolean;
|
|
178
|
+
/** Gets the headers of a plugin, such as version, author, and description */
|
|
179
|
+
getHeaders(name: string): {
|
|
180
|
+
name: string;
|
|
181
|
+
description: string;
|
|
182
|
+
author: string;
|
|
183
|
+
version: string | null;
|
|
184
|
+
reloadRequired: string;
|
|
185
|
+
isLibrary: string;
|
|
186
|
+
downloadUrl: string | null;
|
|
187
|
+
webpage: string | null;
|
|
188
|
+
needsLib: string[];
|
|
189
|
+
optionalLib: string[];
|
|
190
|
+
syncEval: string;
|
|
191
|
+
hasSettings: string;
|
|
192
|
+
};
|
|
193
|
+
/** Gets the exported values of a plugin, if it has been enabled */
|
|
194
|
+
get(name: string): any;
|
|
195
|
+
/**
|
|
196
|
+
* @deprecated Use {@link get} instead
|
|
197
|
+
* @hidden
|
|
198
|
+
*/
|
|
199
|
+
getPlugin(name: string): {
|
|
200
|
+
return: any;
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
class LibsApi {
|
|
205
|
+
/** A list of all the libraries installed */
|
|
206
|
+
get list(): string[];
|
|
207
|
+
/** Gets whether or not a plugin is installed and enabled */
|
|
208
|
+
isEnabled(name: string): boolean;
|
|
209
|
+
/** Gets the headers of a library, such as version, author, and description */
|
|
210
|
+
getHeaders(name: string): {
|
|
211
|
+
name: string;
|
|
212
|
+
description: string;
|
|
213
|
+
author: string;
|
|
214
|
+
version: string | null;
|
|
215
|
+
reloadRequired: string;
|
|
216
|
+
isLibrary: string;
|
|
217
|
+
downloadUrl: string | null;
|
|
218
|
+
webpage: string | null;
|
|
219
|
+
needsLib: string[];
|
|
220
|
+
optionalLib: string[];
|
|
221
|
+
syncEval: string;
|
|
222
|
+
hasSettings: string;
|
|
223
|
+
};
|
|
224
|
+
/** Gets the exported values of a library */
|
|
225
|
+
get(name: string): any;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
class ScopedRewriterApi {
|
|
229
|
+
private readonly id;
|
|
230
|
+
constructor(id: string);
|
|
231
|
+
/**
|
|
232
|
+
* Creates a hook that will modify the code of a script before it is run.
|
|
233
|
+
* This value is cached, so this hook may not run on subsequent page loads.
|
|
234
|
+
* addParseHook should always be called in the top level of a script.
|
|
235
|
+
* @param prefix Limits the hook to only running on scripts beginning with this prefix.
|
|
236
|
+
* Passing `true` will only run on the index script, and passing `false` will run on all scripts.
|
|
237
|
+
* @param callback The function that will modify the code. Should return the modified code. Cannot have side effects.
|
|
238
|
+
*/
|
|
239
|
+
addParseHook(prefix: string | boolean, callback: (code: string) => string): () => void;
|
|
240
|
+
/**
|
|
241
|
+
* Creates a shared value that can be accessed from any script.
|
|
242
|
+
* @param id A unique identifier for the shared value.
|
|
243
|
+
* @param value The value to be shared.
|
|
244
|
+
* @returns A string representing the code to access the shared value.
|
|
245
|
+
*/
|
|
246
|
+
createShared(id: string, value: any): string;
|
|
247
|
+
/** Removes the shared value with a certain id created by {@link createShared} */
|
|
248
|
+
removeSharedById(id: string): void;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
class RewriterApi {
|
|
252
|
+
/**
|
|
253
|
+
* Creates a hook that will modify the code of a script before it is run.
|
|
254
|
+
* This value is cached, so this hook may not run on subsequent page loads.
|
|
255
|
+
* addParseHook should always be called in the top level of a script.
|
|
256
|
+
* @param pluginName The name of the plugin creating the hook.
|
|
257
|
+
* @param prefix Limits the hook to only running on scripts beginning with this prefix.
|
|
258
|
+
* Passing `true` will only run on the index script, and passing `false` will run on all scripts.
|
|
259
|
+
* @param callback The function that will modify the code. Should return the modified code. Cannot have side effects.
|
|
260
|
+
*/
|
|
261
|
+
addParseHook(pluginName: string, prefix: string | boolean, callback: (code: string) => string): () => void;
|
|
262
|
+
/** Removes all hooks created by a certain plugin */
|
|
263
|
+
removeParseHooks(pluginName: string): void;
|
|
264
|
+
/**
|
|
265
|
+
* Creates a shared value that can be accessed from any script.
|
|
266
|
+
* @param pluginName The name of the plugin creating the shared value.
|
|
267
|
+
* @param id A unique identifier for the shared value.
|
|
268
|
+
* @param value The value to be shared.
|
|
269
|
+
* @returns A string representing the code to access the shared value.
|
|
270
|
+
*/
|
|
271
|
+
createShared(pluginName: string, id: string, value: any): string;
|
|
272
|
+
/** Removes all values created by {@link createShared} by a certain plugin */
|
|
273
|
+
removeShared(pluginName: string): void;
|
|
274
|
+
/** Removes the shared value with a certain id created by {@link createShared} */
|
|
275
|
+
removeSharedById(pluginName: string, id: string): void;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
class ScopedPatcherApi {
|
|
279
|
+
private readonly id;
|
|
280
|
+
constructor(id: string);
|
|
281
|
+
/**
|
|
282
|
+
* Runs a callback after a function on an object has been run
|
|
283
|
+
* @returns A function to remove the patch
|
|
284
|
+
*/
|
|
285
|
+
after(object: any, method: string, callback: PatcherAfterCallback): () => void;
|
|
286
|
+
/**
|
|
287
|
+
* Runs a callback before a function on an object has been run.
|
|
288
|
+
* Return true from the callback to prevent the function from running
|
|
289
|
+
* @returns A function to remove the patch
|
|
290
|
+
*/
|
|
291
|
+
before(object: any, method: string, callback: PatcherBeforeCallback): () => void;
|
|
292
|
+
/**
|
|
293
|
+
* Runs a function instead of a function on an object
|
|
294
|
+
* @returns A function to remove the patch
|
|
295
|
+
*/
|
|
296
|
+
instead(object: any, method: string, callback: PatcherInsteadCallback): () => void;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
type PatcherInsteadCallback = (thisVal: any, args: IArguments) => void;
|
|
300
|
+
|
|
301
|
+
type PatcherBeforeCallback = (thisVal: any, args: IArguments) => boolean | undefined;
|
|
302
|
+
|
|
303
|
+
type PatcherAfterCallback = (thisVal: any, args: IArguments, returnVal: any) => any;
|
|
304
|
+
|
|
305
|
+
class PatcherApi {
|
|
306
|
+
/**
|
|
307
|
+
* Runs a callback after a function on an object has been run
|
|
308
|
+
* @returns A function to remove the patch
|
|
309
|
+
*/
|
|
310
|
+
after(id: string, object: any, method: string, callback: PatcherAfterCallback): () => void;
|
|
311
|
+
/**
|
|
312
|
+
* Runs a callback before a function on an object has been run.
|
|
313
|
+
* Return true from the callback to prevent the function from running
|
|
314
|
+
* @returns A function to remove the patch
|
|
315
|
+
*/
|
|
316
|
+
before(id: string, object: any, method: string, callback: PatcherBeforeCallback): () => void;
|
|
317
|
+
/**
|
|
318
|
+
* Runs a function instead of a function on an object
|
|
319
|
+
* @returns A function to remove the patch
|
|
320
|
+
*/
|
|
321
|
+
instead(id: string, object: any, method: string, callback: PatcherInsteadCallback): () => void;
|
|
322
|
+
/** Removes all patches with a given id */
|
|
323
|
+
unpatchAll(id: string): void;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
class ScopedStorageApi {
|
|
327
|
+
private readonly id;
|
|
328
|
+
constructor(id: string);
|
|
329
|
+
/** Gets a value that has previously been saved */
|
|
330
|
+
getValue(key: string, defaultValue?: any): any;
|
|
331
|
+
/** Sets a value which can be retrieved later, persisting through reloads */
|
|
332
|
+
setValue(key: string, value: any): void;
|
|
333
|
+
/** Removes a value which has been saved */
|
|
334
|
+
deleteValue(key: string): void;
|
|
335
|
+
/** Adds a listener for when a stored value with a certain key changes */
|
|
336
|
+
onChange(key: string, callback: ValueChangeCallback): () => void;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
type ValueChangeCallback = (value: any, remote: boolean) => void;
|
|
340
|
+
|
|
341
|
+
class StorageApi {
|
|
342
|
+
/** Gets a value that has previously been saved */
|
|
343
|
+
getValue(pluginName: string, key: string, defaultValue?: any): any;
|
|
344
|
+
/** Sets a value which can be retrieved later, through reloads */
|
|
345
|
+
setValue(pluginName: string, key: string, value: any): void;
|
|
346
|
+
/** Removes a value which has been saved */
|
|
347
|
+
deleteValue(pluginName: string, key: string): void;
|
|
348
|
+
/**
|
|
349
|
+
* @deprecated use {@link deleteValue}
|
|
350
|
+
* @hidden
|
|
351
|
+
*/
|
|
352
|
+
get removeValue(): (pluginName: string, key: string) => void;
|
|
353
|
+
/** Adds a listener for when a plugin's stored value with a certain key changes */
|
|
354
|
+
onChange(pluginName: string, key: string, callback: ValueChangeCallback): () => void;
|
|
355
|
+
/** Removes a listener added by onChange */
|
|
356
|
+
offChange(pluginName: string, key: string, callback: ValueChangeCallback): void;
|
|
357
|
+
/** Removes all listeners added by onChange for a certain plugin */
|
|
358
|
+
offAllChanges(pluginName: string): void;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
class ScopedUIApi extends BaseUIApi {
|
|
362
|
+
private readonly id;
|
|
363
|
+
constructor(id: string);
|
|
364
|
+
/**
|
|
365
|
+
* Adds a style to the DOM
|
|
366
|
+
* @returns A function to remove the styles
|
|
367
|
+
*/
|
|
368
|
+
addStyles(style: string): () => void;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
interface ModalButton {
|
|
372
|
+
text: string;
|
|
373
|
+
style?: "primary" | "danger" | "close";
|
|
374
|
+
onClick?: (event: MouseEvent) => boolean | undefined;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
interface ModalOptions {
|
|
378
|
+
id: string;
|
|
379
|
+
title: string;
|
|
380
|
+
style: string;
|
|
381
|
+
className: string;
|
|
382
|
+
closeOnBackgroundClick: boolean;
|
|
383
|
+
buttons: ModalButton[];
|
|
384
|
+
onClosed: () => void;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
class BaseUIApi {
|
|
388
|
+
/** Shows a customizable modal to the user */
|
|
389
|
+
showModal(element: HTMLElement | import("react").ReactElement, options?: Partial<ModalOptions>): void;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
class UIApi extends BaseUIApi {
|
|
393
|
+
/**
|
|
394
|
+
* Adds a style to the DOM
|
|
395
|
+
* @returns A function to remove the styles
|
|
396
|
+
*/
|
|
397
|
+
addStyles(id: string, style: string): () => void;
|
|
398
|
+
/** Remove all styles with a given id */
|
|
399
|
+
removeStyles(id: string): void;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
class ScopedNetApi extends BaseNetApi {
|
|
403
|
+
private readonly id;
|
|
404
|
+
constructor(id: string);
|
|
405
|
+
/**
|
|
406
|
+
* Runs a callback when the game is loaded, or runs it immediately if the game has already loaded
|
|
407
|
+
* @returns A function to cancel waiting for load
|
|
408
|
+
*/
|
|
409
|
+
onLoad(callback: (type: ConnectionType) => void): () => void;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
type ConnectionType = "None" | "Colyseus" | "Blueboat";
|
|
413
|
+
|
|
414
|
+
class BaseNetApi extends EventEmitter2 {
|
|
415
|
+
constructor();
|
|
416
|
+
/** Which type of server the client is currently connected to */
|
|
417
|
+
get type(): ConnectionType;
|
|
418
|
+
/** The room that the client is connected to, or null if there is no connection */
|
|
419
|
+
get room(): any;
|
|
420
|
+
/** Whether the user is the one hosting the current game */
|
|
421
|
+
get isHost(): boolean;
|
|
422
|
+
/** Sends a message to the server on a specific channel */
|
|
423
|
+
send(channel: string, message: any): void;
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
class NetApi extends BaseNetApi {
|
|
427
|
+
constructor();
|
|
428
|
+
/**
|
|
429
|
+
* Runs a callback when the game is loaded, or runs it immediately if the game has already loaded
|
|
430
|
+
* @returns A function to cancel waiting for load
|
|
431
|
+
*/
|
|
432
|
+
onLoad(id: string, callback: (type: ConnectionType) => void): () => void;
|
|
433
|
+
/** Cancels any calls to {@link onLoad} with the same id */
|
|
434
|
+
offLoad(id: string): void;
|
|
435
|
+
/**
|
|
436
|
+
* @deprecated Methods for both transports are now on the base net api
|
|
437
|
+
* @hidden
|
|
438
|
+
*/
|
|
439
|
+
get colyseus(): this;
|
|
440
|
+
/**
|
|
441
|
+
* @deprecated Methods for both transports are now on the base net api
|
|
442
|
+
* @hidden
|
|
443
|
+
*/
|
|
444
|
+
get blueboat(): this;
|
|
445
|
+
/** @hidden */
|
|
446
|
+
private wrappedListeners;
|
|
447
|
+
/**
|
|
448
|
+
* @deprecated use net.on
|
|
449
|
+
* @hidden
|
|
450
|
+
*/
|
|
451
|
+
addEventListener(channel: string, callback: (...args: any[]) => void): void;
|
|
452
|
+
/**
|
|
453
|
+
* @deprecated use net.off
|
|
454
|
+
* @hidden
|
|
455
|
+
*/
|
|
456
|
+
removeEventListener(channel: string, callback: (...args: any[]) => void): void;
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
class ScopedParcelApi extends BaseParcelApi {
|
|
460
|
+
private readonly id;
|
|
461
|
+
constructor(id: string);
|
|
462
|
+
/**
|
|
463
|
+
* Waits for a module to be loaded, then runs a callback
|
|
464
|
+
* @returns A function to cancel waiting for the module
|
|
465
|
+
*/
|
|
466
|
+
getLazy(): () => void;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
class BaseParcelApi {
|
|
470
|
+
/**
|
|
471
|
+
* Gets a module based on a filter, returns null if none are found
|
|
472
|
+
* Be cautious when using this- plugins will often run before any modules load in,
|
|
473
|
+
* meaning that if this is run on startup it will likely return nothing.
|
|
474
|
+
* Consider using getLazy instead.
|
|
475
|
+
*/
|
|
476
|
+
query(): any;
|
|
477
|
+
/**
|
|
478
|
+
* Returns an array of all loaded modules matching a filter
|
|
479
|
+
* Be cautious when using this- plugins will often run before any modules load in,
|
|
480
|
+
* meaning that if this is run on startup it will likely return nothing.
|
|
481
|
+
* Consider using getLazy instead.
|
|
482
|
+
*/
|
|
483
|
+
queryAll(): any[];
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
class ParcelApi extends BaseParcelApi {
|
|
487
|
+
/**
|
|
488
|
+
* Waits for a module to be loaded, then runs a callback
|
|
489
|
+
* @returns A function to cancel waiting for the module
|
|
490
|
+
*/
|
|
491
|
+
getLazy(): () => void;
|
|
492
|
+
/** Cancels any calls to getLazy with the same id */
|
|
493
|
+
stopLazy(): void;
|
|
494
|
+
/**
|
|
495
|
+
* @deprecated Use {@link getLazy} instead
|
|
496
|
+
* @hidden
|
|
497
|
+
*/
|
|
498
|
+
get interceptRequire(): () => () => void;
|
|
499
|
+
/**
|
|
500
|
+
* @deprecated Use {@link stopLazy} instead
|
|
501
|
+
* @hidden
|
|
502
|
+
*/
|
|
503
|
+
get stopIntercepts(): () => void;
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
class ScopedHotkeysApi extends BaseHotkeysApi {
|
|
507
|
+
private readonly id;
|
|
508
|
+
constructor(id: string);
|
|
509
|
+
/**
|
|
510
|
+
* Adds a hotkey which will fire when certain keys are pressed
|
|
511
|
+
* @returns A function to remove the hotkey
|
|
512
|
+
*/
|
|
513
|
+
addHotkey(options: HotkeyOptions, callback: KeyboardCallback): () => void;
|
|
514
|
+
/**
|
|
515
|
+
* Adds a hotkey which can be changed by the user
|
|
516
|
+
* @returns A function to remove the hotkey
|
|
517
|
+
*/
|
|
518
|
+
addConfigurableHotkey(options: ConfigurableHotkeyOptions, callback: KeyboardCallback): () => void;
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
type KeyboardCallback = (e: KeyboardEvent) => void;
|
|
522
|
+
|
|
523
|
+
class BaseHotkeysApi {
|
|
524
|
+
/**
|
|
525
|
+
* Releases all keys, needed if a hotkey opens something that will
|
|
526
|
+
* prevent keyup events from being registered, such as an alert
|
|
527
|
+
*/
|
|
528
|
+
releaseAll(): void;
|
|
529
|
+
/** Which key codes are currently being pressed */
|
|
530
|
+
get pressed(): Set<string>;
|
|
531
|
+
/**
|
|
532
|
+
* @deprecated Use {@link pressed} instead
|
|
533
|
+
* @hidden
|
|
534
|
+
*/
|
|
535
|
+
get pressedKeys(): Set<string>;
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
interface OldConfigurableOptions {
|
|
539
|
+
category: string;
|
|
540
|
+
title: string;
|
|
541
|
+
preventDefault?: boolean;
|
|
542
|
+
defaultKeys?: Set<string>;
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
interface ConfigurableHotkeyOptions {
|
|
546
|
+
category: string;
|
|
547
|
+
/** There should be no duplicate titles within a category */
|
|
548
|
+
title: string;
|
|
549
|
+
preventDefault?: boolean;
|
|
550
|
+
default?: HotkeyTrigger;
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
interface HotkeyTrigger {
|
|
554
|
+
/** Should be a keyboardevent [code](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code) */
|
|
555
|
+
key?: string;
|
|
556
|
+
/** Should be keyboardevent [codes](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code) */
|
|
557
|
+
keys?: string[];
|
|
558
|
+
ctrl?: boolean;
|
|
559
|
+
shift?: boolean;
|
|
560
|
+
alt?: boolean;
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
interface HotkeyOptions extends HotkeyTrigger {
|
|
564
|
+
preventDefault?: boolean;
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
class HotkeysApi extends BaseHotkeysApi {
|
|
568
|
+
/**
|
|
569
|
+
* Adds a hotkey with a given id
|
|
570
|
+
* @returns A function to remove the hotkey
|
|
571
|
+
*/
|
|
572
|
+
addHotkey(id: string, options: HotkeyOptions, callback: KeyboardCallback): () => void;
|
|
573
|
+
/** Removes all hotkeys with a given id */
|
|
574
|
+
removeHotkeys(id: string): void;
|
|
575
|
+
/**
|
|
576
|
+
* Adds a hotkey which can be changed by the user
|
|
577
|
+
* @param id A unique id for the hotkey, such as `myplugin-myhotkey`
|
|
578
|
+
* @returns A function to remove the hotkey
|
|
579
|
+
*/
|
|
580
|
+
addConfigurableHotkey(id: string, options: ConfigurableHotkeyOptions, callback: KeyboardCallback): () => void;
|
|
581
|
+
/** Removes a configurable hotkey with a given id */
|
|
582
|
+
removeConfigurableHotkey(id: string): void;
|
|
583
|
+
/**
|
|
584
|
+
* @deprecated Use {@link addHotkey} instead
|
|
585
|
+
* @hidden
|
|
586
|
+
*/
|
|
587
|
+
add(keys: Set<string>, callback: KeyboardCallback, preventDefault?: boolean): void;
|
|
588
|
+
/**
|
|
589
|
+
* @deprecated Use {@link removeHotkeys} instead
|
|
590
|
+
* @hidden
|
|
591
|
+
*/
|
|
592
|
+
remove(keys: Set<string>): void;
|
|
593
|
+
/**
|
|
594
|
+
* @deprecated Use {@link addConfigurableHotkey} instead
|
|
595
|
+
* @hidden
|
|
596
|
+
*/
|
|
597
|
+
addConfigurable(
|
|
598
|
+
pluginName: string,
|
|
599
|
+
hotkeyId: string,
|
|
600
|
+
callback: KeyboardCallback,
|
|
601
|
+
options: OldConfigurableOptions,
|
|
602
|
+
): void;
|
|
603
|
+
/**
|
|
604
|
+
* @deprecated Use {@link removeConfigurableHotkeys} instead
|
|
605
|
+
* @hidden
|
|
606
|
+
*/
|
|
607
|
+
removeConfigurable(pluginName: string, hotkeyId: string): void;
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
class Api {
|
|
611
|
+
/**
|
|
612
|
+
* @deprecated Gimkit has switched from Parcel to vite, rendering this api useless.
|
|
613
|
+
* @hidden
|
|
614
|
+
*/
|
|
615
|
+
static parcel: Readonly<ParcelApi>;
|
|
616
|
+
/** Functions to edit Gimkit's code */
|
|
617
|
+
static rewriter: Readonly<RewriterApi>;
|
|
618
|
+
/** Functions to listen for key combinations */
|
|
619
|
+
static hotkeys: Readonly<HotkeysApi>;
|
|
620
|
+
/**
|
|
621
|
+
* Ways to interact with the current connection to the server,
|
|
622
|
+
* and functions to send general requests
|
|
623
|
+
*/
|
|
624
|
+
static net: Readonly<NetApi>;
|
|
625
|
+
/** Functions for interacting with the DOM */
|
|
626
|
+
static UI: Readonly<UIApi>;
|
|
627
|
+
/** Functions for persisting data between reloads */
|
|
628
|
+
static storage: Readonly<StorageApi>;
|
|
629
|
+
/** Functions for intercepting the arguments and return values of functions */
|
|
630
|
+
static patcher: Readonly<PatcherApi>;
|
|
631
|
+
/** Methods for getting info on libraries */
|
|
632
|
+
static libs: Readonly<LibsApi>;
|
|
633
|
+
/** Gets the exported values of a library */
|
|
634
|
+
static lib: (name: string) => any;
|
|
635
|
+
/** Methods for getting info on plugins */
|
|
636
|
+
static plugins: Readonly<PluginsApi>;
|
|
637
|
+
/** Gets the exported values of a plugin, if it has been enabled */
|
|
638
|
+
static plugin: (name: string) => any;
|
|
639
|
+
/** Gimkit's internal react instance */
|
|
640
|
+
static get React(): typeof import("react");
|
|
641
|
+
/** Gimkit's internal reactDom instance */
|
|
642
|
+
static get ReactDOM(): typeof import("react-dom/client");
|
|
643
|
+
/** A variety of Gimkit internal objects available in 2d gamemodes */
|
|
644
|
+
static get stores(): any;
|
|
645
|
+
/**
|
|
646
|
+
* Gimkit's notification object, only available when joining or playing a game
|
|
647
|
+
*
|
|
648
|
+
* {@link https://ant.design/components/notification}
|
|
649
|
+
*/
|
|
650
|
+
static get notification(): any;
|
|
651
|
+
/**
|
|
652
|
+
* @deprecated No longer supported
|
|
653
|
+
* @hidden
|
|
654
|
+
*/
|
|
655
|
+
static get contextMenu(): {
|
|
656
|
+
showContextMenu: () => void;
|
|
657
|
+
createReactContextMenu: () => void;
|
|
658
|
+
};
|
|
659
|
+
/**
|
|
660
|
+
* @deprecated No longer supported
|
|
661
|
+
* @hidden
|
|
662
|
+
*/
|
|
663
|
+
static get platformerPhysics(): any;
|
|
664
|
+
/**
|
|
665
|
+
* @deprecated The api no longer emits events. Use GL.net.loaded to listen to load events
|
|
666
|
+
* @hidden
|
|
667
|
+
*/
|
|
668
|
+
static addEventListener(type: string, callback: () => void): void;
|
|
669
|
+
/**
|
|
670
|
+
* @deprecated The api no longer emits events
|
|
671
|
+
* @hidden
|
|
672
|
+
*/
|
|
673
|
+
static removeEventListener(type: string, callback: () => void): void;
|
|
674
|
+
/**
|
|
675
|
+
* @deprecated Use {@link plugins} instead
|
|
676
|
+
* @hidden
|
|
677
|
+
*/
|
|
678
|
+
static get pluginManager(): Readonly<PluginsApi>;
|
|
679
|
+
constructor(type?: string, name?: string);
|
|
680
|
+
/**
|
|
681
|
+
* @deprecated Gimkit has switched from Parcel to vite, rendering this api useless.
|
|
682
|
+
* @hidden
|
|
683
|
+
*/
|
|
684
|
+
parcel: Readonly<ScopedParcelApi>;
|
|
685
|
+
/** Functions to edit Gimkit's code */
|
|
686
|
+
rewriter: Readonly<ScopedRewriterApi>;
|
|
687
|
+
/** Functions to listen for key combinations */
|
|
688
|
+
hotkeys: Readonly<ScopedHotkeysApi>;
|
|
689
|
+
/**
|
|
690
|
+
* Ways to interact with the current connection to the server,
|
|
691
|
+
* and functions to send general requests
|
|
692
|
+
*/
|
|
693
|
+
net: Readonly<ScopedNetApi>;
|
|
694
|
+
/** Functions for interacting with the DOM */
|
|
695
|
+
UI: Readonly<ScopedUIApi>;
|
|
696
|
+
/** Functions for persisting data between reloads */
|
|
697
|
+
storage: Readonly<ScopedStorageApi>;
|
|
698
|
+
/** Functions for intercepting the arguments and return values of functions */
|
|
699
|
+
patcher: Readonly<ScopedPatcherApi>;
|
|
700
|
+
/** Methods for getting info on libraries */
|
|
701
|
+
libs: Readonly<LibsApi>;
|
|
702
|
+
/** Gets the exported values of a library */
|
|
703
|
+
lib: (name: string) => any;
|
|
704
|
+
/** Methods for getting info on plugins */
|
|
705
|
+
plugins: Readonly<PluginsApi>;
|
|
706
|
+
/** Gets the exported values of a plugin, if it has been enabled */
|
|
707
|
+
plugin: (name: string) => any;
|
|
708
|
+
/** Gimkit's internal react instance */
|
|
709
|
+
get React(): typeof import("react");
|
|
710
|
+
/** Gimkit's internal reactDom instance */
|
|
711
|
+
get ReactDOM(): typeof import("react-dom/client");
|
|
712
|
+
/** A variety of gimkit internal objects available in 2d gamemodes */
|
|
713
|
+
get stores(): any;
|
|
714
|
+
/**
|
|
715
|
+
* Gimkit's notification object, only available when joining or playing a game
|
|
716
|
+
*
|
|
717
|
+
* {@link https://ant.design/components/notification}
|
|
718
|
+
*/
|
|
719
|
+
get notification(): any;
|
|
720
|
+
/** Run a callback when the plugin or library is disabled */
|
|
721
|
+
onStop: (callback: () => void) => void;
|
|
722
|
+
/**
|
|
723
|
+
* Run a callback when the plugin's settings menu button is clicked
|
|
724
|
+
*
|
|
725
|
+
* This function is not available for libraries
|
|
726
|
+
*/
|
|
727
|
+
openSettingsMenu: (callback: () => void) => void;
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
declare const api: Gimloader.Api;
|
|
732
|
+
declare const GL: typeof Gimloader.Api;
|
|
733
|
+
/** @deprecated Use GL.stores */
|
|
734
|
+
declare const stores: any;
|
|
735
|
+
/** @deprecated No longer supported */
|
|
736
|
+
declare const platformerPhysics: any;
|
|
737
|
+
|
|
738
|
+
interface Window {
|
|
739
|
+
api: Gimloader.Api;
|
|
740
|
+
GL: typeof Gimloader.Api;
|
|
741
|
+
/** @deprecated Use GL.stores */
|
|
742
|
+
stores: any;
|
|
743
|
+
/** @deprecated No longer supported */
|
|
744
|
+
platformerPhysics: any;
|
|
745
|
+
}
|
gimloader/package.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@types/gimloader",
|
|
3
|
+
"version": "1.6.0",
|
|
4
|
+
"description": "TypeScript definitions for gimloader",
|
|
5
|
+
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/gimloader",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"contributors": [
|
|
8
|
+
{
|
|
9
|
+
"name": "TheLazySquid",
|
|
10
|
+
"githubUsername": "TheLazySquid",
|
|
11
|
+
"url": "https://github.com/TheLazySquid"
|
|
12
|
+
}
|
|
13
|
+
],
|
|
14
|
+
"main": "",
|
|
15
|
+
"types": "index.d.ts",
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
|
19
|
+
"directory": "types/gimloader"
|
|
20
|
+
},
|
|
21
|
+
"scripts": {},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@types/react": "*",
|
|
24
|
+
"@types/react-dom": "*"
|
|
25
|
+
},
|
|
26
|
+
"peerDependencies": {},
|
|
27
|
+
"typesPublisherContentHash": "d804a544bedef771c8985233d4e23a8bfcfadafa34060303ba20e3dbe79b51f8",
|
|
28
|
+
"typeScriptVersion": "5.2"
|
|
29
|
+
}
|