From 31d37e8c381673088bc8f8998eb0bb6ea5a51328 Mon Sep 17 00:00:00 2001 From: tophf Date: Wed, 19 Jun 2024 16:10:18 +0300 Subject: [PATCH] doc: GM_getValues, GM_setValues, GM_deleteValues --- index.d.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/index.d.ts b/index.d.ts index 3c1c9cc..ae585c5 100644 --- a/index.d.ts +++ b/index.d.ts @@ -5,6 +5,8 @@ declare type VMScriptRunAt = 'document-start' | 'document-body' | 'document-end' /** Injection mode of a script. */ declare type VMScriptInjectInto = 'auto' | 'page' | 'content'; +declare type GenericObject = Record; + declare interface VMScriptGMInfoPlatform { arch: 'arm' | 'arm64' | 'x86-32' | 'x86-64' | 'mips' | 'mips64'; /** @alias browserBrand @@ -93,10 +95,18 @@ declare function GM_log(...args: any): void; /** Retrieves a value for current script from storage. */ declare function GM_getValue(name: string, defaultValue?: T): T; +/** @since VM2.19.1 */ +declare function GM_getValues(names: string[]): GenericObject; +/** @since VM2.19.1 */ +declare function GM_getValues(namesWithDefaults: GenericObject): GenericObject; /** Sets a key / value pair for current script to storage. */ declare function GM_setValue(name: string, value: T): void; +/** @since VM2.19.1 */ +declare function GM_setValues(values: GenericObject): void; /** Deletes an existing key / value pair for current script from storage. */ declare function GM_deleteValue(name: string): void; +/** @since VM2.19.1 */ +declare function GM_deleteValues(names: string[]): void; /** Returns an array of keys of all available values within this script. */ declare function GM_listValues(): string[]; @@ -438,12 +448,20 @@ declare interface VMScriptGMObjectVMExtensions { addElement: typeof GM_addElement; addStyle: typeof GM_addStyle; addValueChangeListener: typeof GM_addValueChangeListener; + /** @since VM2.19.1 */ + deleteValues: (names: string[]) => Promise; download: ((options: VMScriptGMDownloadOptions) => (Promise | void)) | ((url: string, name: string) => (Promise | void)); getResourceText: typeof GM_getResourceText; + /** @since VM2.19.1 */ + getValues: + ((names: string[]) => Promise) | + ((namesWithDefaults: GenericObject) => Promise); log: typeof GM_log; removeValueChangeListener: typeof GM_removeValueChangeListener; + /** @since VM2.19.1 */ + setValues: (values: GenericObject) => Promise; unregisterMenuCommand: typeof GM_unregisterMenuCommand; }