GM.getValue: Difference between revisions

From GreaseSpot Wiki
Jump to navigationJump to search
m →‎Syntax: remove extra space
Line 17: Line 17:
: <code>String</code> The property name to get. See [[GM_setValue#Arguments|GM_setValue]] for details.
: <code>String</code> The property name to get. See [[GM_setValue#Arguments|GM_setValue]] for details.
; <code>default</code>
; <code>default</code>
: Any value to be returned, when no value has previously been set.
: Optional. Any value to be returned, when no value has previously been set.


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

Revision as of 21:36, 8 February 2010


Description

This method retrieves a value that was set with GM_setValue. See GM_setValue for details on the storage of these values.

Compatibility: Greasemonkey 0.3b+

Syntax

function GM_getValue( name, default )

Arguments

name
String The property name to get. See GM_setValue for details.
default
Optional. Any value to be returned, when no value has previously been set.

Returns

When this name has been set
String, Integer or Boolean as previously set
When this name has not been set, and default is provided
The value passed as default
When this name has not been set, and default is not
null

Examples

GM_log(GM_getValue("foo"));

See Also