@henrikvilhelmberglund/vite-plugin-monkey 4.0.4

Sign up to get free protection for your applications and to get access to all the features.
package/global.d.ts ADDED
@@ -0,0 +1,1294 @@
1
+ export {};
2
+
3
+ type WebRequestRule = {
4
+ selector:
5
+ | string
6
+ | {
7
+ include?: string | string[];
8
+ match?: string | string[];
9
+ exclude?: string | string[];
10
+ };
11
+ action:
12
+ | "cancel"
13
+ | {
14
+ cancel?: boolean;
15
+ redirect?:
16
+ | string
17
+ | {
18
+ from: string;
19
+ to: string;
20
+ };
21
+ };
22
+ };
23
+ type TamperScriptMeta = {
24
+ name_i18n: Record<string, string>;
25
+ description_i18n: Record<string, string>;
26
+ antifeatures: Record<string, Record<string, string>>;
27
+ blockers: unknown[];
28
+ "run-at": string;
29
+ options: object;
30
+ icon64?: string;
31
+ sync: {
32
+ imported: number;
33
+ };
34
+ webRequest?: string[];
35
+ requires: {
36
+ textContent: string;
37
+ }[];
38
+ };
39
+ type TamperInfo = {
40
+ downloadMode: "native" | "browser" | "disabled";
41
+ isIncognito: boolean;
42
+ isFirstPartyIsolation?: boolean;
43
+ scriptSource: string;
44
+ };
45
+ /**
46
+ * @see https://developer.chrome.com/docs/extensions/reference/cookies/#type-Cookie
47
+ */
48
+ type ChromeCookie = {
49
+ domain?: string;
50
+ expirationDate?: number;
51
+ httpOnly?: boolean;
52
+ name?: string;
53
+ path?: string;
54
+ sameSite?: "no_restriction" | "lax" | "strict" | "unspecified";
55
+ secure?: boolean;
56
+ storeId?: string;
57
+ url?: string;
58
+ value?: string;
59
+ };
60
+ type CbCookie = {
61
+ domain: string;
62
+ hostOnly: boolean;
63
+ httpOnly: boolean;
64
+ name: string;
65
+ path: string;
66
+ sameSite: string;
67
+ secure: boolean;
68
+ session: boolean;
69
+ value: string;
70
+ };
71
+ type CookieDetails = {
72
+ list: {
73
+ url?: string;
74
+ domain?: string;
75
+ name?: string;
76
+ path?: string;
77
+ };
78
+ set: ChromeCookie;
79
+ delete: {
80
+ name?: string;
81
+ url?: string;
82
+ };
83
+ };
84
+ type CookieCallBack = {
85
+ list: (cookies: CbCookie[], error: unknown) => void;
86
+ set: (error: unknown) => void;
87
+ delete: (error: unknown) => void;
88
+ };
89
+ type CookieResult = {
90
+ list: Promise<CbCookie[]>;
91
+ set: (error: unknown) => Promise<void>;
92
+ delete: (error: unknown) => Promise<void>;
93
+ };
94
+ type GmCookieFc = {
95
+ list: (
96
+ details: CookieDetails["list"],
97
+ callback?: CookieCallBack["list"],
98
+ ) => CookieResult["list"];
99
+ set: (
100
+ details: CookieDetails["set"],
101
+ callback?: CookieCallBack["set"],
102
+ ) => CookieResult["set"];
103
+ delete: (
104
+ details: CookieDetails["delete"],
105
+ callback?: CookieCallBack["delete"],
106
+ ) => CookieResult["delete"];
107
+ };
108
+ type WebRequestListener = (
109
+ info: "cancel" | "redirect",
110
+ message: "ok" | "error",
111
+ details: {
112
+ rule: WebRequestRule;
113
+ url: string;
114
+ redirect_url: string;
115
+ description: string;
116
+ },
117
+ ) => void;
118
+ type ViolentInfo = {
119
+ uuid: string;
120
+ injectInto: string;
121
+ platform: ViolentPlatform;
122
+ };
123
+ type ViolentPlatform = {
124
+ arch: "arm" | "mips" | "mips64" | "x86-32" | "x86-64";
125
+ browserName: string;
126
+ browserVersion: string;
127
+ os: "android" | "cros" | "linux" | "mac" | "openbsd" | "win";
128
+ };
129
+ type ViolentScriptMeta = {
130
+ excludeMatches: string[];
131
+ runAt: string;
132
+ homepageURL?: string;
133
+ license: string;
134
+ require: string[];
135
+ };
136
+ type CommonScriptMeta = {
137
+ namespace: string;
138
+ name: string;
139
+ author?: string;
140
+ description?: string;
141
+ icon?: string;
142
+ excludes: string[];
143
+ includes: string[];
144
+ matches: string[];
145
+ resources: {
146
+ name: string;
147
+ url: string;
148
+ content: string;
149
+ meta: string;
150
+ }[];
151
+ runAt: string;
152
+ version: string;
153
+ noframes: boolean;
154
+ unwrap: boolean;
155
+ homepage: string;
156
+ };
157
+ type ScriptMeta = CommonScriptMeta & TamperScriptMeta & ViolentScriptMeta;
158
+ type CommonInfo = {
159
+ version: string;
160
+ scriptHandler: string;
161
+ scriptMetaStr: string;
162
+ scriptSource: string;
163
+ scriptUpdateURL?: string;
164
+ scriptWillUpdate: boolean;
165
+ script: ScriptMeta;
166
+ };
167
+ type HTMLElementTagName = keyof HTMLElementTagNameMap;
168
+ type GmAddElementFc = {
169
+ <K extends HTMLElementTagName>(
170
+ tagName: K,
171
+ attributes?: Partial<HTMLElementTagNameMap[K]>,
172
+ ): HTMLElementTagNameMap[K];
173
+ (tagName: string, attributes?: Partial<HTMLElement>): HTMLElement;
174
+ <K extends HTMLElementTagName>(
175
+ parentNode: Node | Element | ShadowRoot,
176
+ tagName: K,
177
+ attributes?: Partial<HTMLElementTagNameMap[K]>,
178
+ ): HTMLElementTagNameMap[K];
179
+ (
180
+ parentNode: Node | Element | ShadowRoot,
181
+ tagName: string,
182
+ attributes?: Partial<HTMLElement>,
183
+ ): HTMLElement;
184
+ };
185
+ type GmOpenHandle = {
186
+ onclose?: () => void;
187
+ closed: boolean;
188
+ close: () => void;
189
+ };
190
+ type GmOpenInTabFc = {
191
+ (url: string, details?: GmOpenInTabDetails): GmOpenHandle;
192
+ (url: string, openInBackground?: boolean): GmOpenHandle;
193
+ };
194
+ /**
195
+ * @available violentmonkey
196
+ */
197
+ type GmNotificationControl = {
198
+ /**
199
+ * @available violentmonkey
200
+ */
201
+ remove: () => Promise<void>;
202
+ };
203
+ type GmNotificationFc = {
204
+ (
205
+ text: string,
206
+ title?: string,
207
+ image?: string,
208
+ onclick?: () => void,
209
+ ): GmNotificationControl;
210
+ (details: GmNotificationDetails, ondone?: () => void): GmNotificationControl;
211
+ };
212
+ type GmDownloadErrorEvent = {
213
+ /**
214
+ * Error reason
215
+ * - `not_enabled` - the download feature isn't enabled by the user
216
+ * - `not_whitelisted` - the requested file extension is not
217
+ * whitelisted
218
+ * - `not_permitted` - the user enabled the download feature, but did
219
+ * not give the downloads permission
220
+ * - `not_supported` - the download feature isn't supported by the
221
+ * browser/version
222
+ * - `not_succeeded` - the download wasn't started or failed, the
223
+ * details attribute may provide more information
224
+ */
225
+ error:
226
+ | "not_enabled"
227
+ | "not_whitelisted"
228
+ | "not_permitted"
229
+ | "not_supported"
230
+ | "not_succeeded";
231
+ details?: string;
232
+ };
233
+ type GmRequestEventListener<Event> = (this: Event, event: Event) => void;
234
+ type GmProgressEventBase = {
235
+ done: number;
236
+ lengthComputable: boolean;
237
+ loaded: number;
238
+ position: number;
239
+ total: number;
240
+ totalSize: number;
241
+ };
242
+ type GmDownloadProgressEvent = GmProgressEventBase & {
243
+ readonly finalUrl: string;
244
+ };
245
+ type GmResponseTypeMap = {
246
+ text: string;
247
+ json: any;
248
+ arraybuffer: ArrayBuffer;
249
+ blob: Blob;
250
+ document: Document;
251
+ stream: ReadableStream<Uint8Array>;
252
+ };
253
+ type GmResponseType = keyof GmResponseTypeMap;
254
+ type GmAbortHandle<TReturn = void> = {
255
+ abort(): TReturn;
256
+ };
257
+ type GmResponseEventBase<TResponseType extends GmResponseType> = {
258
+ responseHeaders: string;
259
+ /**
260
+ * 0 = XMLHttpRequest.UNSENT
261
+ *
262
+ * 1 = XMLHttpRequest.OPENED
263
+ *
264
+ * 2 = XMLHttpRequest.HEADERS_RECEIVED
265
+ *
266
+ * 3 = XMLHttpRequest.HEADERS_RECEIVED
267
+ *
268
+ * 4 = XMLHttpRequest.DONE
269
+ */
270
+ readyState: 0 | 1 | 2 | 3 | 4;
271
+ response: GmResponseTypeMap[TResponseType];
272
+ responseText: string;
273
+ responseXML: Document | null;
274
+ status: number;
275
+ statusText: string;
276
+ };
277
+ type GmErrorEvent<TResponseType extends GmResponseType> =
278
+ GmResponseEventBase<TResponseType> & {
279
+ error: string;
280
+ };
281
+ type GmResponseEvent<
282
+ TContext,
283
+ TResponseType extends GmResponseType,
284
+ > = GmResponseEventBase<TResponseType> & {
285
+ finalUrl: string;
286
+ context: TContext;
287
+ };
288
+ type ProgressResponse<
289
+ TContext,
290
+ TResponseType extends GmResponseType,
291
+ > = GmResponseEvent<TContext, TResponseType> & GmProgressEventBase;
292
+ type GmXhr = {
293
+ <TContext, TResponseType extends GmResponseType = "text">(
294
+ details: GmXhrRequest<TContext, TResponseType>,
295
+ ): GmAbortHandle;
296
+ /**
297
+ * @available tampermonkey
298
+ * @see [tampermonkey#1278](https://github.com/Tampermonkey/tampermonkey/issues/1278#issuecomment-884363078)
299
+ */
300
+ RESPONSE_TYPE_STREAM?: "stream";
301
+ };
302
+ type MonkeyWindow = typeof window & {
303
+ unsafeWindow: typeof window;
304
+ /**
305
+ * @see https://www.tampermonkey.net/documentation.php#api:window.close
306
+ * @see https://violentmonkey.github.io/api/metadata-block/#grant
307
+ */
308
+ close: () => void;
309
+ /**
310
+ * @see https://www.tampermonkey.net/documentation.php#api:window.focus
311
+ * @see https://violentmonkey.github.io/api/metadata-block/#grant
312
+ */
313
+ focus: () => void;
314
+ /**
315
+ * @see https://www.tampermonkey.net/documentation.php#api:window.onurlchange
316
+ * @available tampermonkey
317
+ */
318
+ onurlchange?: null;
319
+ /**
320
+ * @see https://www.tampermonkey.net/documentation.php#api:window.onurlchange
321
+ * @available tampermonkey
322
+ */
323
+ addEventListener: (
324
+ type: "urlchange",
325
+ cb: (data: { url: string }) => void,
326
+ ) => void;
327
+ /**
328
+ * @see https://www.tampermonkey.net/documentation.php#api:window.onurlchange
329
+ * @available tampermonkey
330
+ */
331
+ removeEventListener: (
332
+ type: "urlchange",
333
+ cb: (...args: unknown[]) => unknown,
334
+ ) => void;
335
+ GM: {
336
+ addStyle: MonkeyWindow["GM_addStyle"];
337
+ addElement: MonkeyWindow["GM_addElement"];
338
+ /**
339
+ * @see https://wiki.greasespot.net/GM.registerMenuCommand
340
+ */
341
+ registerMenuCommand: MonkeyWindow["GM_registerMenuCommand"];
342
+ /**
343
+ * @see https://wiki.greasespot.net/GM.info
344
+ */
345
+ info: MonkeyWindow["GM_info"];
346
+ /**
347
+ * @available tampermonkey
348
+ */
349
+ cookie: MonkeyWindow["GM_cookie"];
350
+ /**
351
+ * @see https://wiki.greasespot.net/GM.notification
352
+ */
353
+ notification: MonkeyWindow["GM_notification"];
354
+ /**
355
+ * @see https://wiki.greasespot.net/GM.openInTab
356
+ */
357
+ openInTab: MonkeyWindow["GM_openInTab"];
358
+ /**
359
+ * @see https://wiki.greasespot.net/GM.setClipboard
360
+ */
361
+ setClipboard: MonkeyWindow["GM_setClipboard"];
362
+ /**
363
+ * @see https://wiki.greasespot.net/GM.xmlHttpRequest
364
+ */
365
+ xmlHttpRequest: MonkeyWindow["GM_xmlhttpRequest"];
366
+ /**
367
+ * @see https://wiki.greasespot.net/GM.deleteValue
368
+ */
369
+ deleteValue: (key: string) => Promise<void>;
370
+ /**
371
+ * @see https://wiki.greasespot.net/GM.getResourceUrl
372
+ */
373
+ getResourceURL: (name: string, isBlobUrl?: boolean) => Promise<string>;
374
+ /**
375
+ * @see https://wiki.greasespot.net/GM.getValue
376
+ */
377
+ getValue: <T = unknown>(key: string, defaultValue: T) => Promise<T>;
378
+ /**
379
+ * @see https://wiki.greasespot.net/GM.listValues
380
+ */
381
+ listValues: () => Promise<string[]>;
382
+ /**
383
+ * @see https://wiki.greasespot.net/GM.setValue
384
+ */
385
+ setValue: (key: string, value: unknown) => Promise<void>;
386
+ };
387
+ /**
388
+ * @see https://www.tampermonkey.net/documentation.php#GM_addElement
389
+ * @see https://violentmonkey.github.io/api/gm/#gm_addelement
390
+ */
391
+ GM_addElement: GmAddElementFc;
392
+ /**
393
+ * @see https://www.tampermonkey.net/documentation.php#GM_addStyle
394
+ * @see https://violentmonkey.github.io/api/gm/#gm_addstyle
395
+ */
396
+ GM_addStyle: (css: string) => HTMLStyleElement;
397
+ /**
398
+ * @see https://www.tampermonkey.net/documentation.php#GM_addValueChangeListener
399
+ * @see https://violentmonkey.github.io/api/gm/#gm_addvaluechangelistener
400
+ */
401
+ GM_addValueChangeListener: <T = unknown>(
402
+ name: string,
403
+ callback: (
404
+ name: string,
405
+ oldValue?: T,
406
+ newValue?: T,
407
+ remote?: boolean,
408
+ ) => void,
409
+ ) => string;
410
+ /**
411
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_cookie.list
412
+ * @see https://www.tampermonkey.net/documentation.php##api:GM_cookie.set
413
+ * @see https://www.tampermonkey.net/documentation.php##api:GM_cookie.delete
414
+ * @available tampermonkey
415
+ */
416
+ GM_cookie: GmCookieFc;
417
+ /**
418
+ * @see https://www.tampermonkey.net/documentation.php#GM_deleteValue
419
+ * @see https://violentmonkey.github.io/api/gm/#gm_deletevalue
420
+ */
421
+ GM_deleteValue: (name: string) => void;
422
+ /**
423
+ * @see https://www.tampermonkey.net/documentation.php#GM_getResourceText
424
+ * @see https://violentmonkey.github.io/api/gm/#gm_getresourcetext
425
+ */
426
+ GM_getResourceText: (name: string) => string;
427
+ /**
428
+ * @see https://www.tampermonkey.net/documentation.php#GM_getResourceURL
429
+ * @see https://violentmonkey.github.io/api/gm/#gm_getresourceurl
430
+ */
431
+ GM_getResourceURL: (name: string, isBlobUrl?: boolean) => string;
432
+ /**
433
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_getValue
434
+ * @see https://violentmonkey.github.io/api/gm/#gm_getvalue
435
+ */
436
+ GM_getValue: <T = unknown>(key: string, defaultValue?: T) => T;
437
+ /**
438
+ * @see https://www.tampermonkey.net/documentation.php#GM_getTab
439
+ * @available tampermonkey
440
+ */
441
+ GM_getTab: <T = any>(callback: (tab: T) => void) => void;
442
+ /**
443
+ * @see https://www.tampermonkey.net/documentation.php#GM_getTabs
444
+ * @available tampermonkey
445
+ */
446
+ GM_getTabs: <T = any>(
447
+ callback: (tabsMap: { [tabId: number]: T }) => void,
448
+ ) => void;
449
+ /**
450
+ * @see https://www.tampermonkey.net/documentation.php#GM_info
451
+ * @see https://violentmonkey.github.io/api/gm/#gm_info
452
+ */
453
+ GM_info: GmScriptInfo;
454
+ /**
455
+ * @see https://www.tampermonkey.net/documentation.php#GM_listValues
456
+ * @see https://violentmonkey.github.io/api/gm/#gm_listvalues
457
+ */
458
+ GM_listValues: () => string[];
459
+ /**
460
+ * @see https://www.tampermonkey.net/documentation.php#GM_log
461
+ * @available tampermonkey
462
+ */
463
+ GM_log: (...data: any[]) => void;
464
+ /**
465
+ * @see https://www.tampermonkey.net/documentation.php#GM_notification
466
+ * @see https://violentmonkey.github.io/api/gm/#gm_notification
467
+ */
468
+ GM_notification: GmNotificationFc;
469
+ /**
470
+ * @see https://www.tampermonkey.net/documentation.php#GM_openInTab
471
+ * @see https://violentmonkey.github.io/api/gm/#gm_openintab
472
+ */
473
+ GM_openInTab: GmOpenInTabFc;
474
+ /**
475
+ * @see https://www.tampermonkey.net/documentation.php#GM_registerMenuCommand
476
+ * @see https://violentmonkey.github.io/api/gm/#gm_registermenucommand
477
+ */
478
+ GM_registerMenuCommand: <T extends MouseEvent | KeyboardEvent>(
479
+ caption: string,
480
+ onClick: (event: T) => void,
481
+ accessKey?: string,
482
+ ) => string;
483
+ /**
484
+ * @see https://www.tampermonkey.net/documentation.php#GM_removeValueChangeListener
485
+ * @see https://violentmonkey.github.io/api/gm/#gm_removevaluechangelistener
486
+ */
487
+ GM_removeValueChangeListener: (listenerId: string) => void;
488
+ /**
489
+ * @see https://www.tampermonkey.net/documentation.php#GM_saveTab
490
+ * @available tampermonkey
491
+ */
492
+ GM_saveTab: (tab: unknown) => void;
493
+ /**
494
+ * @see https://www.tampermonkey.net/documentation.php#GM_setClipboard
495
+ * @see https://violentmonkey.github.io/api/gm/#gm_setclipboard
496
+ */
497
+ GM_setClipboard: (data: string, type: string) => void;
498
+ /**
499
+ * @see https://www.tampermonkey.net/documentation.php#GM_setValue
500
+ * @see https://violentmonkey.github.io/api/gm/#gm_setvalue
501
+ */
502
+ GM_setValue: (key: string, value: unknown) => void;
503
+ /**
504
+ * @see https://www.tampermonkey.net/documentation.php#GM_unregisterMenuCommand
505
+ * @see https://violentmonkey.github.io/api/gm/#gm_unregistermenucommand
506
+ */
507
+ GM_unregisterMenuCommand: (caption: string) => void;
508
+ /**
509
+ * @see https://www.tampermonkey.net/documentation.php#GM_xmlhttpRequest
510
+ * @see https://violentmonkey.github.io/api/gm/#gm_xmlhttprequest
511
+ */
512
+ GM_xmlhttpRequest: GmXhr;
513
+ /**
514
+ * @see https://www.tampermonkey.net/documentation.php#GM_download
515
+ * @see https://violentmonkey.github.io/api/gm/#gm_download
516
+ */
517
+ GM_download: {
518
+ (options: GmDownloadRequest): GmAbortHandle<boolean>;
519
+ (url: string, name?: string): GmAbortHandle<boolean>;
520
+ };
521
+ /**
522
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_webRequest
523
+ */
524
+ GM_webRequest: (
525
+ rules: WebRequestRule[],
526
+ listener: WebRequestListener,
527
+ ) => void;
528
+ };
529
+
530
+ declare global {
531
+ /**
532
+ * GM_info Type
533
+ */
534
+ type GmScriptInfo = CommonInfo & TamperInfo & ViolentInfo;
535
+ type GmOpenInTabDetails = {
536
+ active?: boolean;
537
+ insert?: boolean;
538
+ /**
539
+ * @available tampermonkey
540
+ */
541
+ setParent?: boolean;
542
+ /**
543
+ * @available tampermonkey
544
+ */
545
+ incognito?: boolean;
546
+ /**
547
+ * @available violentmonkey
548
+ */
549
+ container?: 0 | 1 | 2;
550
+ /**
551
+ * @available violentmonkey
552
+ */
553
+ pinned?: boolean;
554
+ };
555
+ type GmNotificationDetails = {
556
+ text: string;
557
+ title?: string;
558
+ image?: string;
559
+ /**
560
+ * @available tampermonkey
561
+ */
562
+ highlight?: boolean;
563
+ /**
564
+ * @available tampermonkey
565
+ */
566
+ silent?: boolean;
567
+ /**
568
+ * @available tampermonkey
569
+ */
570
+ timeout?: number;
571
+ ondone?: () => void;
572
+ onclick?: () => void;
573
+ };
574
+ type GmDownloadRequest = {
575
+ /**
576
+ * URL from where the data should be downloaded
577
+ */
578
+ url: string;
579
+ /**
580
+ * Filename - for security reasons the file extension needs to be
581
+ * whitelisted at Tampermonkey options page
582
+ */
583
+ name: string;
584
+ headers?: Record<string, string>;
585
+ /**
586
+ * Show 'Save As' dialog
587
+ */
588
+ saveAs?: boolean;
589
+ timeout?: number;
590
+ onerror?: GmRequestEventListener<GmDownloadErrorEvent>;
591
+ ontimeout?(): void;
592
+ onload?(): void;
593
+ onprogress?: GmRequestEventListener<GmDownloadProgressEvent>;
594
+ };
595
+ type GmXhrRequest<TContext, TResponseType extends GmResponseType> = {
596
+ method?: string;
597
+ url: string;
598
+ headers?: Record<string, string>;
599
+ data?:
600
+ | string
601
+ | URLSearchParams
602
+ | FormData
603
+ | ArrayBuffer
604
+ | Blob
605
+ | DataView
606
+ | ReadableStream;
607
+ /**
608
+ * @available tampermonkey
609
+ */
610
+ redirect?: `follow` | `error` | `manual`;
611
+ /**
612
+ * @available tampermonkey
613
+ */
614
+ cookie?: string;
615
+ binary?: boolean;
616
+ /**
617
+ * @available tampermonkey
618
+ */
619
+ nocache?: boolean;
620
+ /**
621
+ * @available tampermonkey
622
+ */
623
+ revalidate?: boolean;
624
+ timeout?: number;
625
+ /**
626
+ * Property which will be added to the response event object
627
+ */
628
+ context?: TContext;
629
+ /**
630
+ * @tampermonkey text, json, arraybuffer, blob, document, stream
631
+ * @violentmonkey text, json, arraybuffer, blob, document
632
+ * @default
633
+ * 'text'
634
+ */
635
+ responseType?: TResponseType;
636
+ overrideMimeType?: string;
637
+ anonymous?: boolean;
638
+ /**
639
+ * @available tampermonkey
640
+ */
641
+ fetch?: boolean;
642
+ user?: string;
643
+ password?: string;
644
+ onabort?: () => void;
645
+ onerror?: GmRequestEventListener<GmErrorEvent<TResponseType>>;
646
+ /**
647
+ * @available violentmonkey
648
+ */
649
+ onloadend?: GmRequestEventListener<
650
+ GmResponseEvent<TContext, TResponseType>
651
+ >;
652
+ onloadstart?: GmRequestEventListener<
653
+ GmResponseEvent<TContext, TResponseType>
654
+ >;
655
+ onprogress?: GmRequestEventListener<
656
+ ProgressResponse<TContext, TResponseType>
657
+ >;
658
+ onreadystatechange?: GmRequestEventListener<
659
+ GmResponseEvent<TContext, TResponseType>
660
+ >;
661
+ ontimeout?: () => void;
662
+ onload?: GmRequestEventListener<GmResponseEvent<TContext, TResponseType>>;
663
+ };
664
+ const GM: {
665
+ addStyle: (css: string) => HTMLStyleElement;
666
+ addElement: {
667
+ <K extends keyof HTMLElementTagNameMap>(
668
+ tagName: K,
669
+ attributes?: Partial<HTMLElementTagNameMap[K]> | undefined,
670
+ ): HTMLElementTagNameMap[K];
671
+ (
672
+ tagName: string,
673
+ attributes?: Partial<HTMLElement> | undefined,
674
+ ): HTMLElement;
675
+ <K_1 extends keyof HTMLElementTagNameMap>(
676
+ parentNode: Node | Element | ShadowRoot,
677
+ tagName: K_1,
678
+ attributes?: Partial<HTMLElementTagNameMap[K_1]> | undefined,
679
+ ): HTMLElementTagNameMap[K_1];
680
+ (
681
+ parentNode: Node | Element | ShadowRoot,
682
+ tagName: string,
683
+ attributes?: Partial<HTMLElement> | undefined,
684
+ ): HTMLElement;
685
+ };
686
+ registerMenuCommand: <T extends MouseEvent | KeyboardEvent>(
687
+ caption: string,
688
+ onClick: (event: T) => void,
689
+ accessKey?: string | undefined,
690
+ ) => string;
691
+ info: GmScriptInfo;
692
+ cookie: GmCookieFc;
693
+ notification: {
694
+ (
695
+ text: string,
696
+ title?: string | undefined,
697
+ image?: string | undefined,
698
+ onclick?: (() => void) | undefined,
699
+ ): {
700
+ remove: () => Promise<void>;
701
+ };
702
+ (
703
+ details: GmNotificationDetails,
704
+ ondone?: (() => void) | undefined,
705
+ ): {
706
+ remove: () => Promise<void>;
707
+ };
708
+ };
709
+ openInTab: {
710
+ (
711
+ url: string,
712
+ details?: GmOpenInTabDetails | undefined,
713
+ ): {
714
+ onclose?: (() => void) | undefined;
715
+ closed: boolean;
716
+ close: () => void;
717
+ };
718
+ (
719
+ url: string,
720
+ openInBackground?: boolean | undefined,
721
+ ): {
722
+ onclose?: (() => void) | undefined;
723
+ closed: boolean;
724
+ close: () => void;
725
+ };
726
+ };
727
+ setClipboard: (data: string, type: string) => void;
728
+ xmlHttpRequest: {
729
+ <
730
+ TContext,
731
+ TResponseType extends keyof {
732
+ text: string;
733
+ json: any;
734
+ arraybuffer: ArrayBuffer;
735
+ blob: Blob;
736
+ document: Document;
737
+ stream: ReadableStream<Uint8Array>;
738
+ } = "text",
739
+ >(
740
+ details: GmXhrRequest<TContext, TResponseType>,
741
+ ): {
742
+ abort(): void;
743
+ };
744
+ RESPONSE_TYPE_STREAM?: "stream" | undefined;
745
+ };
746
+ deleteValue: (key: string) => Promise<void>;
747
+ getResourceURL: (
748
+ name: string,
749
+ isBlobUrl?: boolean | undefined,
750
+ ) => Promise<string>;
751
+ getValue: <T = unknown>(key: string, defaultValue: T) => Promise<T>;
752
+ listValues: () => Promise<string[]>;
753
+ setValue: (key: string, value: unknown) => Promise<void>;
754
+ };
755
+ const unsafeWindow: Window & typeof globalThis;
756
+ /**
757
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_info
758
+ * @see https://violentmonkey.github.io/api/gm/#gm_info
759
+ */
760
+ const GM_info: GmScriptInfo;
761
+ /**
762
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_cookie.list
763
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_cookie.set
764
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_cookie.delete
765
+ * @available tampermonkey
766
+ */
767
+ const GM_cookie: GmCookieFc;
768
+ /**
769
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_setValue
770
+ * @see https://violentmonkey.github.io/api/gm/#gm_setvalue
771
+ */
772
+ const GM_setValue: (key: string, value: unknown) => void;
773
+ /**
774
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_deleteValue
775
+ * @see https://violentmonkey.github.io/api/gm/#gm_deletevalue
776
+ */
777
+ const GM_deleteValue: (name: string) => void;
778
+ /**
779
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_listValues
780
+ * @see https://violentmonkey.github.io/api/gm/#gm_listvalues
781
+ */
782
+ const GM_listValues: () => string[];
783
+ /**
784
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_addValueChangeListener
785
+ * @see https://violentmonkey.github.io/api/gm/#gm_addvaluechangelistener
786
+ */
787
+ const GM_addValueChangeListener: <T = unknown>(
788
+ name: string,
789
+ callback: (
790
+ name: string,
791
+ oldValue?: T | undefined,
792
+ newValue?: T | undefined,
793
+ remote?: boolean | undefined,
794
+ ) => void,
795
+ ) => string;
796
+ /**
797
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_removeValueChangeListener
798
+ * @see https://violentmonkey.github.io/api/gm/#gm_removevaluechangelistener
799
+ */
800
+ const GM_removeValueChangeListener: (listenerId: string) => void;
801
+ /**
802
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_getResourceText
803
+ * @see https://violentmonkey.github.io/api/gm/#gm_getresourcetext
804
+ */
805
+ const GM_getResourceText: (name: string) => string;
806
+ /**
807
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_getResourceURL
808
+ * @see https://violentmonkey.github.io/api/gm/#gm_getresourceurl
809
+ */
810
+ const GM_getResourceURL: (
811
+ name: string,
812
+ isBlobUrl?: boolean | undefined,
813
+ ) => string;
814
+ /**
815
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_addElement
816
+ * @see https://violentmonkey.github.io/api/gm/#gm_addelement
817
+ */
818
+ const GM_addElement: {
819
+ <K extends keyof HTMLElementTagNameMap>(
820
+ tagName: K,
821
+ attributes?: Partial<HTMLElementTagNameMap[K]> | undefined,
822
+ ): HTMLElementTagNameMap[K];
823
+ (
824
+ tagName: string,
825
+ attributes?: Partial<HTMLElement> | undefined,
826
+ ): HTMLElement;
827
+ <K_1 extends keyof HTMLElementTagNameMap>(
828
+ parentNode: Node | Element | ShadowRoot,
829
+ tagName: K_1,
830
+ attributes?: Partial<HTMLElementTagNameMap[K_1]> | undefined,
831
+ ): HTMLElementTagNameMap[K_1];
832
+ (
833
+ parentNode: Node | Element | ShadowRoot,
834
+ tagName: string,
835
+ attributes?: Partial<HTMLElement> | undefined,
836
+ ): HTMLElement;
837
+ };
838
+ /**
839
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_addStyle
840
+ * @see https://violentmonkey.github.io/api/gm/#gm_addstyle
841
+ */
842
+ const GM_addStyle: (css: string) => HTMLStyleElement;
843
+ /**
844
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_openInTab
845
+ * @see https://violentmonkey.github.io/api/gm/#gm_openintab
846
+ */
847
+ const GM_openInTab: {
848
+ (
849
+ url: string,
850
+ details?: GmOpenInTabDetails | undefined,
851
+ ): {
852
+ onclose?: (() => void) | undefined;
853
+ closed: boolean;
854
+ close: () => void;
855
+ };
856
+ (
857
+ url: string,
858
+ openInBackground?: boolean | undefined,
859
+ ): {
860
+ onclose?: (() => void) | undefined;
861
+ closed: boolean;
862
+ close: () => void;
863
+ };
864
+ };
865
+ /**
866
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_registerMenuCommand
867
+ * @see https://violentmonkey.github.io/api/gm/#gm_registermenucommand
868
+ */
869
+ const GM_registerMenuCommand: <T extends MouseEvent | KeyboardEvent>(
870
+ caption: string,
871
+ onClick: (event: T) => void,
872
+ accessKey?: string | undefined,
873
+ ) => string;
874
+ /**
875
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_unregisterMenuCommand
876
+ * @see https://violentmonkey.github.io/api/gm/#gm_unregistermenucommand
877
+ */
878
+ const GM_unregisterMenuCommand: (caption: string) => void;
879
+ /**
880
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_notification
881
+ * @see https://violentmonkey.github.io/api/gm/#gm_notification
882
+ */
883
+ const GM_notification: {
884
+ (
885
+ text: string,
886
+ title?: string | undefined,
887
+ image?: string | undefined,
888
+ onclick?: (() => void) | undefined,
889
+ ): {
890
+ remove: () => Promise<void>;
891
+ };
892
+ (
893
+ details: GmNotificationDetails,
894
+ ondone?: (() => void) | undefined,
895
+ ): {
896
+ remove: () => Promise<void>;
897
+ };
898
+ };
899
+ /**
900
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_xmlhttpRequest
901
+ * @see https://violentmonkey.github.io/api/gm/#gm_xmlhttprequest
902
+ */
903
+ const GM_xmlhttpRequest: {
904
+ <
905
+ TContext,
906
+ TResponseType extends keyof {
907
+ text: string;
908
+ json: any;
909
+ arraybuffer: ArrayBuffer;
910
+ blob: Blob;
911
+ document: Document;
912
+ stream: ReadableStream<Uint8Array>;
913
+ } = "text",
914
+ >(
915
+ details: GmXhrRequest<TContext, TResponseType>,
916
+ ): {
917
+ abort(): void;
918
+ };
919
+ RESPONSE_TYPE_STREAM?: "stream" | undefined;
920
+ };
921
+ /**
922
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_setClipboard
923
+ * @see https://violentmonkey.github.io/api/gm/#gm_setclipboard
924
+ */
925
+ const GM_setClipboard: (data: string, type: string) => void;
926
+ /**
927
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_download
928
+ * @see https://violentmonkey.github.io/api/gm/#gm_download
929
+ */
930
+ const GM_download: {
931
+ (options: GmDownloadRequest): {
932
+ abort(): boolean;
933
+ };
934
+ (
935
+ url: string,
936
+ name?: string | undefined,
937
+ ): {
938
+ abort(): boolean;
939
+ };
940
+ };
941
+ /**
942
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_log
943
+ * @available tampermonkey
944
+ */
945
+ const GM_log: (...data: any[]) => void;
946
+ /**
947
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_getTab
948
+ * @available tampermonkey
949
+ */
950
+ const GM_getTab: <T = any>(callback: (tab: T) => void) => void;
951
+ /**
952
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_saveTab
953
+ * @available tampermonkey
954
+ */
955
+ const GM_saveTab: (tab: unknown) => void;
956
+ /**
957
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_getTabs
958
+ * @available tampermonkey
959
+ */
960
+ const GM_getTabs: <T = any>(
961
+ callback: (tabsMap: { [tabId: number]: T }) => void,
962
+ ) => void;
963
+ /**
964
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_getValue
965
+ * @see https://violentmonkey.github.io/api/gm/#gm_getvalue
966
+ */
967
+ const GM_getValue: <T = unknown>(
968
+ key: string,
969
+ defaultValue?: T | undefined,
970
+ ) => T;
971
+ /**
972
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_webRequest
973
+ * @available tampermonkey
974
+ */
975
+ const GM_webRequest: (
976
+ rules: WebRequestRule[],
977
+ listener: WebRequestListener,
978
+ ) => void;
979
+
980
+ interface Window {
981
+ GM: {
982
+ addStyle: (css: string) => HTMLStyleElement;
983
+ addElement: {
984
+ <K extends keyof HTMLElementTagNameMap>(
985
+ tagName: K,
986
+ attributes?: Partial<HTMLElementTagNameMap[K]> | undefined,
987
+ ): HTMLElementTagNameMap[K];
988
+ (
989
+ tagName: string,
990
+ attributes?: Partial<HTMLElement> | undefined,
991
+ ): HTMLElement;
992
+ <K_1 extends keyof HTMLElementTagNameMap>(
993
+ parentNode: Node | Element | ShadowRoot,
994
+ tagName: K_1,
995
+ attributes?: Partial<HTMLElementTagNameMap[K_1]> | undefined,
996
+ ): HTMLElementTagNameMap[K_1];
997
+ (
998
+ parentNode: Node | Element | ShadowRoot,
999
+ tagName: string,
1000
+ attributes?: Partial<HTMLElement> | undefined,
1001
+ ): HTMLElement;
1002
+ };
1003
+ registerMenuCommand: <T extends MouseEvent | KeyboardEvent>(
1004
+ caption: string,
1005
+ onClick: (event: T) => void,
1006
+ accessKey?: string | undefined,
1007
+ ) => string;
1008
+ info: GmScriptInfo;
1009
+ cookie: GmCookieFc;
1010
+ notification: {
1011
+ (
1012
+ text: string,
1013
+ title?: string | undefined,
1014
+ image?: string | undefined,
1015
+ onclick?: (() => void) | undefined,
1016
+ ): {
1017
+ remove: () => Promise<void>;
1018
+ };
1019
+ (
1020
+ details: GmNotificationDetails,
1021
+ ondone?: (() => void) | undefined,
1022
+ ): {
1023
+ remove: () => Promise<void>;
1024
+ };
1025
+ };
1026
+ openInTab: {
1027
+ (
1028
+ url: string,
1029
+ details?: GmOpenInTabDetails | undefined,
1030
+ ): {
1031
+ onclose?: (() => void) | undefined;
1032
+ closed: boolean;
1033
+ close: () => void;
1034
+ };
1035
+ (
1036
+ url: string,
1037
+ openInBackground?: boolean | undefined,
1038
+ ): {
1039
+ onclose?: (() => void) | undefined;
1040
+ closed: boolean;
1041
+ close: () => void;
1042
+ };
1043
+ };
1044
+ setClipboard: (data: string, type: string) => void;
1045
+ xmlHttpRequest: {
1046
+ <
1047
+ TContext,
1048
+ TResponseType extends keyof {
1049
+ text: string;
1050
+ json: any;
1051
+ arraybuffer: ArrayBuffer;
1052
+ blob: Blob;
1053
+ document: Document;
1054
+ stream: ReadableStream<Uint8Array>;
1055
+ } = "text",
1056
+ >(
1057
+ details: GmXhrRequest<TContext, TResponseType>,
1058
+ ): {
1059
+ abort(): void;
1060
+ };
1061
+ RESPONSE_TYPE_STREAM?: "stream" | undefined;
1062
+ };
1063
+ deleteValue: (key: string) => Promise<void>;
1064
+ getResourceURL: (
1065
+ name: string,
1066
+ isBlobUrl?: boolean | undefined,
1067
+ ) => Promise<string>;
1068
+ getValue: <T = unknown>(key: string, defaultValue: T) => Promise<T>;
1069
+ listValues: () => Promise<string[]>;
1070
+ setValue: (key: string, value: unknown) => Promise<void>;
1071
+ };
1072
+ unsafeWindow: Window & typeof globalThis;
1073
+ /**
1074
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_info
1075
+ * @see https://violentmonkey.github.io/api/gm/#gm_info
1076
+ */
1077
+ GM_info: GmScriptInfo;
1078
+ /**
1079
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_cookie.list
1080
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_cookie.set
1081
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_cookie.delete
1082
+ * @available tampermonkey
1083
+ */
1084
+ GM_cookie: GmCookieFc;
1085
+ /**
1086
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_setValue
1087
+ * @see https://violentmonkey.github.io/api/gm/#gm_setvalue
1088
+ */
1089
+ GM_setValue: (key: string, value: unknown) => void;
1090
+ /**
1091
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_deleteValue
1092
+ * @see https://violentmonkey.github.io/api/gm/#gm_deletevalue
1093
+ */
1094
+ GM_deleteValue: (name: string) => void;
1095
+ /**
1096
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_listValues
1097
+ * @see https://violentmonkey.github.io/api/gm/#gm_listvalues
1098
+ */
1099
+ GM_listValues: () => string[];
1100
+ /**
1101
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_addValueChangeListener
1102
+ * @see https://violentmonkey.github.io/api/gm/#gm_addvaluechangelistener
1103
+ */
1104
+ GM_addValueChangeListener: <T = unknown>(
1105
+ name: string,
1106
+ callback: (
1107
+ name: string,
1108
+ oldValue?: T | undefined,
1109
+ newValue?: T | undefined,
1110
+ remote?: boolean | undefined,
1111
+ ) => void,
1112
+ ) => string;
1113
+ /**
1114
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_removeValueChangeListener
1115
+ * @see https://violentmonkey.github.io/api/gm/#gm_removevaluechangelistener
1116
+ */
1117
+ GM_removeValueChangeListener: (listenerId: string) => void;
1118
+ /**
1119
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_getResourceText
1120
+ * @see https://violentmonkey.github.io/api/gm/#gm_getresourcetext
1121
+ */
1122
+ GM_getResourceText: (name: string) => string;
1123
+ /**
1124
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_getResourceURL
1125
+ * @see https://violentmonkey.github.io/api/gm/#gm_getresourceurl
1126
+ */
1127
+ GM_getResourceURL: (
1128
+ name: string,
1129
+ isBlobUrl?: boolean | undefined,
1130
+ ) => string;
1131
+ /**
1132
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_addElement
1133
+ * @see https://violentmonkey.github.io/api/gm/#gm_addelement
1134
+ */
1135
+ GM_addElement: {
1136
+ <K extends keyof HTMLElementTagNameMap>(
1137
+ tagName: K,
1138
+ attributes?: Partial<HTMLElementTagNameMap[K]> | undefined,
1139
+ ): HTMLElementTagNameMap[K];
1140
+ (
1141
+ tagName: string,
1142
+ attributes?: Partial<HTMLElement> | undefined,
1143
+ ): HTMLElement;
1144
+ <K_1 extends keyof HTMLElementTagNameMap>(
1145
+ parentNode: Node | Element | ShadowRoot,
1146
+ tagName: K_1,
1147
+ attributes?: Partial<HTMLElementTagNameMap[K_1]> | undefined,
1148
+ ): HTMLElementTagNameMap[K_1];
1149
+ (
1150
+ parentNode: Node | Element | ShadowRoot,
1151
+ tagName: string,
1152
+ attributes?: Partial<HTMLElement> | undefined,
1153
+ ): HTMLElement;
1154
+ };
1155
+ /**
1156
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_addStyle
1157
+ * @see https://violentmonkey.github.io/api/gm/#gm_addstyle
1158
+ */
1159
+ GM_addStyle: (css: string) => HTMLStyleElement;
1160
+ /**
1161
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_openInTab
1162
+ * @see https://violentmonkey.github.io/api/gm/#gm_openintab
1163
+ */
1164
+ GM_openInTab: {
1165
+ (
1166
+ url: string,
1167
+ details?: GmOpenInTabDetails | undefined,
1168
+ ): {
1169
+ onclose?: (() => void) | undefined;
1170
+ closed: boolean;
1171
+ close: () => void;
1172
+ };
1173
+ (
1174
+ url: string,
1175
+ openInBackground?: boolean | undefined,
1176
+ ): {
1177
+ onclose?: (() => void) | undefined;
1178
+ closed: boolean;
1179
+ close: () => void;
1180
+ };
1181
+ };
1182
+ /**
1183
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_registerMenuCommand
1184
+ * @see https://violentmonkey.github.io/api/gm/#gm_registermenucommand
1185
+ */
1186
+ GM_registerMenuCommand: <T extends MouseEvent | KeyboardEvent>(
1187
+ caption: string,
1188
+ onClick: (event: T) => void,
1189
+ accessKey?: string | undefined,
1190
+ ) => string;
1191
+ /**
1192
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_unregisterMenuCommand
1193
+ * @see https://violentmonkey.github.io/api/gm/#gm_unregistermenucommand
1194
+ */
1195
+ GM_unregisterMenuCommand: (caption: string) => void;
1196
+ /**
1197
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_notification
1198
+ * @see https://violentmonkey.github.io/api/gm/#gm_notification
1199
+ */
1200
+ GM_notification: {
1201
+ (
1202
+ text: string,
1203
+ title?: string | undefined,
1204
+ image?: string | undefined,
1205
+ onclick?: (() => void) | undefined,
1206
+ ): {
1207
+ remove: () => Promise<void>;
1208
+ };
1209
+ (
1210
+ details: GmNotificationDetails,
1211
+ ondone?: (() => void) | undefined,
1212
+ ): {
1213
+ remove: () => Promise<void>;
1214
+ };
1215
+ };
1216
+ /**
1217
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_xmlhttpRequest
1218
+ * @see https://violentmonkey.github.io/api/gm/#gm_xmlhttprequest
1219
+ */
1220
+ GM_xmlhttpRequest: {
1221
+ <
1222
+ TContext,
1223
+ TResponseType extends keyof {
1224
+ text: string;
1225
+ json: any;
1226
+ arraybuffer: ArrayBuffer;
1227
+ blob: Blob;
1228
+ document: Document;
1229
+ stream: ReadableStream<Uint8Array>;
1230
+ } = "text",
1231
+ >(
1232
+ details: GmXhrRequest<TContext, TResponseType>,
1233
+ ): {
1234
+ abort(): void;
1235
+ };
1236
+ RESPONSE_TYPE_STREAM?: "stream" | undefined;
1237
+ };
1238
+ /**
1239
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_setClipboard
1240
+ * @see https://violentmonkey.github.io/api/gm/#gm_setclipboard
1241
+ */
1242
+ GM_setClipboard: (data: string, type: string) => void;
1243
+ /**
1244
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_download
1245
+ * @see https://violentmonkey.github.io/api/gm/#gm_download
1246
+ */
1247
+ GM_download: {
1248
+ (options: GmDownloadRequest): {
1249
+ abort(): boolean;
1250
+ };
1251
+ (
1252
+ url: string,
1253
+ name?: string | undefined,
1254
+ ): {
1255
+ abort(): boolean;
1256
+ };
1257
+ };
1258
+ /**
1259
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_log
1260
+ * @available tampermonkey
1261
+ */
1262
+ GM_log: (...data: any[]) => void;
1263
+ /**
1264
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_getTab
1265
+ * @available tampermonkey
1266
+ */
1267
+ GM_getTab: <T = any>(callback: (tab: T) => void) => void;
1268
+ /**
1269
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_saveTab
1270
+ * @available tampermonkey
1271
+ */
1272
+ GM_saveTab: (tab: unknown) => void;
1273
+ /**
1274
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_getTabs
1275
+ * @available tampermonkey
1276
+ */
1277
+ GM_getTabs: <T = any>(
1278
+ callback: (tabsMap: { [tabId: number]: T }) => void,
1279
+ ) => void;
1280
+ /**
1281
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_getValue
1282
+ * @see https://violentmonkey.github.io/api/gm/#gm_getvalue
1283
+ */
1284
+ GM_getValue: <T = unknown>(key: string, defaultValue?: T | undefined) => T;
1285
+ /**
1286
+ * @see https://www.tampermonkey.net/documentation.php#api:GM_webRequest
1287
+ * @available tampermonkey
1288
+ */
1289
+ GM_webRequest: (
1290
+ rules: WebRequestRule[],
1291
+ listener: WebRequestListener,
1292
+ ) => void;
1293
+ }
1294
+ }