GM.listValues: Difference between revisions

From GreaseSpot Wiki
Jump to navigationJump to search
Marti (talk | contribs)
m →‎Description: Link to metadata vals
under to dot in API link; mention more explicitly that the strings are value _names_
 
(23 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{underscore|title=GM_listValues}}
{{DISPLAYTITLE:GM_listValues}}
__NOTOC__
{{Greasemonkey Manual TOC}}


== Description ==
== Description ==


This [[API_reference|API]] method retrieves an array of preference names that start with the branches root.
This method retrieves an array of preference names that this script has stored.
See [[GM.setValue]] for details on the storage of these values.


Values are retrieved from the [http://developer.mozilla.org/en/docs/Code_snippets:Preferences Firefox preferences] back end and can be manually viewed by typing [[mozillazine:About:config|about:config]] in the address bar and searching for the preference name "<code>greasemonkey.scriptval.[[Metadata_block#.40namespace|namespace]]/[[Metadata_block#.40name|name]].</code>".
== Syntax ==


[[#Examples|Examples]] | [[#See_Also|See Also]] | [[#Notes|Notes]]
{{Function|GM.listValues|}}


== Syntax ==
Compatibility: [[Version_history#4.0_2|Greasemonkey 4.0+]]


'''GM_listValues()'''
=== Arguments ===


:Value: Function
None.
:Returns: String Array
:Compatibility: [[Version_history#Trunk|Greasemonkey Trunk]]


:{| cellpadding="5" style="border-style:solid; background:#FFFFE0;"
=== Returns ===
|+ Parameters
!style="background:#CC9900;"|'''Properties'''
|-
|}
:* There are currently no properties.


[[#top|top]]
A [[Promise]], rejected in case of error and otherwise resolved with an <code>Array</code> of <code>String</code>s names for previously set values.


== Examples ==
== Examples ==
<code><pre>
alert(GM_listValues());
</pre></code>


[[#top|top]]
<pre class='sample'>
console.log(await GM.listValues());
</pre>


== See Also ==
== See Also ==
* [[GM_getValue]]
* [[GM_setValue]]
* [[GM_deleteValue]]
[[#top|top]]


== Notes ==
* [[GM.getValue]]
* [[GM.setValue]]
* [[GM.deleteValue]]


[[#top|top]]
[[Category:API_Reference|L]]
[[Category:API_Reference|L]]

Latest revision as of 20:49, 20 October 2022


Description

This method retrieves an array of preference names that this script has stored. See GM.setValue for details on the storage of these values.

Syntax

function GM.listValues( )

Compatibility: Greasemonkey 4.0+

Arguments

None.

Returns

A Promise, rejected in case of error and otherwise resolved with an Array of Strings names for previously set values.

Examples

console.log(await GM.listValues());

See Also