Skip to content

Commit 31d37e8

Browse files
committed
doc: GM_getValues, GM_setValues, GM_deleteValues
1 parent 1455e1a commit 31d37e8

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

index.d.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ declare type VMScriptRunAt = 'document-start' | 'document-body' | 'document-end'
55
/** Injection mode of a script. */
66
declare type VMScriptInjectInto = 'auto' | 'page' | 'content';
77

8+
declare type GenericObject = Record<string, unknown>;
9+
810
declare interface VMScriptGMInfoPlatform {
911
arch: 'arm' | 'arm64' | 'x86-32' | 'x86-64' | 'mips' | 'mips64';
1012
/** @alias browserBrand
@@ -93,10 +95,18 @@ declare function GM_log(...args: any): void;
9395

9496
/** Retrieves a value for current script from storage. */
9597
declare function GM_getValue<T>(name: string, defaultValue?: T): T;
98+
/** @since VM2.19.1 */
99+
declare function GM_getValues(names: string[]): GenericObject;
100+
/** @since VM2.19.1 */
101+
declare function GM_getValues(namesWithDefaults: GenericObject): GenericObject;
96102
/** Sets a key / value pair for current script to storage. */
97103
declare function GM_setValue<T>(name: string, value: T): void;
104+
/** @since VM2.19.1 */
105+
declare function GM_setValues(values: GenericObject): void;
98106
/** Deletes an existing key / value pair for current script from storage. */
99107
declare function GM_deleteValue(name: string): void;
108+
/** @since VM2.19.1 */
109+
declare function GM_deleteValues(names: string[]): void;
100110
/** Returns an array of keys of all available values within this script. */
101111
declare function GM_listValues(): string[];
102112

@@ -438,12 +448,20 @@ declare interface VMScriptGMObjectVMExtensions {
438448
addElement: typeof GM_addElement;
439449
addStyle: typeof GM_addStyle;
440450
addValueChangeListener: typeof GM_addValueChangeListener;
451+
/** @since VM2.19.1 */
452+
deleteValues: (names: string[]) => Promise<void>;
441453
download:
442454
((options: VMScriptGMDownloadOptions) => (Promise<Blob> | void)) |
443455
((url: string, name: string) => (Promise<Blob> | void));
444456
getResourceText: typeof GM_getResourceText;
457+
/** @since VM2.19.1 */
458+
getValues:
459+
((names: string[]) => Promise<GenericObject>) |
460+
((namesWithDefaults: GenericObject) => Promise<GenericObject>);
445461
log: typeof GM_log;
446462
removeValueChangeListener: typeof GM_removeValueChangeListener;
463+
/** @since VM2.19.1 */
464+
setValues: (values: GenericObject) => Promise<void>;
447465
unregisterMenuCommand: typeof GM_unregisterMenuCommand;
448466
}
449467

0 commit comments

Comments
 (0)