GM.getValue: Difference between revisions

From GreaseSpot Wiki
Jump to navigationJump to search
LouCypher (talk | contribs)
mNo edit summary
Tom (talk | contribs)
about:config
Line 2: Line 2:
{{underscore|title=GM_getValue}}
{{underscore|title=GM_getValue}}


= Syntax =
== Syntax ==


'''GM_getValue(''' ''name'', ''default'' ''')'''
'''GM_getValue(' name'', ''default ')'''


= Description =
== Description ==
 
Retrieve a value set with [[GM_setValue]]. Values are saved in the [[http://developer.mozilla.org/en/docs/Code_snippets:Preferences|Firefox preferences]] back end and can be changed by typing <code>about:config</code> in the address bar and searching for the preference name "greasemonkey.scriptval.''script-namespace''/''script-name''.


Retrieve a value set with [[GM_setValue]].
If the value is not found, default is returned instead.
If the value is not found, default is returned instead.
If default is not supplied, <code>undefined</code> is returned.
If default is not supplied, <code>undefined</code> is returned.


= Examples =
== Examples ==


alert(GM_getValue("foo"));
alert(GM_getValue("foo"));


= See Also =
== See also ==


* [[GM_setValue]]
* [[GM_setValue]]


[[Category:API Reference|G]]
[[Category:API Reference|G]]

Revision as of 01:54, 23 September 2007

Template:Underscore

Syntax

GM_getValue(' name, default ')

Description

Retrieve a value set with GM_setValue. Values are saved in the [preferences] back end and can be changed by typing about:config in the address bar and searching for the preference name "greasemonkey.scriptval.script-namespace/script-name.

If the value is not found, default is returned instead. If default is not supplied, undefined is returned.

Examples

alert(GM_getValue("foo"));

See also