Difference between revisions of "GM.listValues"

From GreaseSpot Wiki
Jump to navigationJump to search
m (move compatibility to description section)
(Update for 4.0)
 
(2 intermediate revisions by the same user not shown)
Line 6: Line 6:
See [[GM_setValue]] for details on the storage of these values.
See [[GM_setValue]] for details on the storage of these values.


Compatibility: [[Version_history#0.8.20090123.1|Greasemonkey 0.8.1+]]
== Syntax ==


== Syntax ==
{{Function|GM.listValues|}}


{{Function|GM_listValues|}}
Compatibility: [[Version_history#4.0_2|Greasemonkey 4.0+]]


== Arguments ==
=== Arguments ===


None.
None.


== Returns ==
=== Returns ===


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


== Examples ==
== Examples ==


<pre class='sample'>
<pre class='sample'>
GM_log(GM_listValues());
console.log(await GM.listValues());
</pre>
 
An array of all values used by a script:
 
<pre class='sample'>
var vals = [];
for each (var val in GM_listValues()) {
  vals.push(GM_getValue(val));
}
</pre>
</pre>


== See Also ==
== See Also ==


* [[GM_getValue]]
* [[GM.getValue]]
* [[GM_setValue]]
* [[GM.setValue]]
* [[GM_deleteValue]]
* [[GM.deleteValue]]


[[Category:API_Reference|L]]
[[Category:API_Reference|L]]

Latest revision as of 09:29, 3 November 2017


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 for previously set values.

Examples

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

See Also