GM.deleteValue: Difference between revisions

From GreaseSpot Wiki
Jump to navigationJump to search
(→‎Examples: deleting all values)
m (→‎Examples: fix formatting, and make the code actually work (for..in iterates keys, on an array this is broken as used))
Line 28: Line 28:


<pre class='sample'>
<pre class='sample'>
var values = GM_listValues();
var keys = GM_listValues();
for (var key in values){
for (var i=0, key=null; key=keys[i]; i++) {
GM_deleteValue(key);
  GM_deleteValue(key);
}
}
</pre>
</pre>

Revision as of 16:39, 20 March 2010


Description

This method deletes an existing persistent value See GM_setValue for details on the storage of these values.

Syntax

function GM_deleteValue( name )

Compatibility: Greasemonkey 0.8.1+

Arguments

name
Property name to delete. See GM_setValue for details.

Returns

undefined

Examples

GM_deleteValue("foo");
var keys = GM_listValues();
for (var i=0, key=null; key=keys[i]; i++) {
  GM_deleteValue(key);
}

See Also

Notes

An issue that some may encounter on some platforms is that the values appear to not be deleted or set. This is usually due to a refreshing issue in the browser. If about:config is refreshed in the window/tab this should resolve any questions about stability of setting and deleting system preferences.