Preferences API

  • Revision slug: Preferences_API
  • Revision title: Preferences API
  • Revision id: 44065
  • Created:
  • Creator: Nickolay
  • Is current revision? No
  • Comment update link; one or more formatting changes

Revision Content

 

Preferences API allows you to save and read strings, numbers, booleans, and references to files to the preferences store. It is relatively easy to use, while providing a number of useful user and developer features, including support for default preferences, user overrides via user.js, and locking.

You can also create a XUL-based options window easily to allow user modify some preferences. Many applications including Firefox and Thunderbird have an additional tool for power users, about:config, which can be used to tweak the preferences without UI.

Interfaces

The preferences API is exposed as a set of frozen XPCOM components and interfaces: nsIPrefService, nsIPrefBranch, nsIPrefBranch2.

...

See also

{{ languages( { "pl": "pl/API_Preferencji" } ) }}

Revision Source

<p> </p>
<p>Preferences API allows you to save and read strings, numbers, booleans, and references to files to the preferences store. It is relatively easy to use, while providing a <a href="/en/A_Brief_Guide_to_Mozilla_Preferences" title="en/A Brief Guide to Mozilla Preferences">number of useful user and developer features</a>, including support for default preferences, user overrides via user.js, and locking.</p>
<p>You can also create a XUL-based <a href="/en/Preferences_System" title="en/Preferences_System"> options window</a> easily to allow user modify some preferences. Many applications including Firefox and Thunderbird have an additional tool for power users, <a class="external" href="http://kb.mozillazine.org/about:config">about:config</a>, which can be used to tweak the preferences without UI.</p>
<h3 name="Interfaces">Interfaces</h3>
<p>The preferences API is exposed as a set of frozen XPCOM components and interfaces: <code><a href="/en/XPCOM_Interface_Reference/nsIPrefService" title="en/XPCOM_Interface_Reference/nsIPrefService">nsIPrefService</a></code>, <code><a href="/en/XPCOM_Interface_Reference/nsIPrefBranch" title="en/XPCOM_Interface_Reference/nsIPrefBranch">nsIPrefBranch</a></code>, <code><a href="/en/XPCOM_Interface_Reference/nsIPrefBranch2" title="en/XPCOM_Interface_Reference/nsIPrefBranch2">nsIPrefBranch2</a></code>.</p>
<p><span class="comment">...</span></p>
<h3 name="See_also">See also</h3>
<ul> <li><a href="/en/Code_snippets/Preferences" title="en/Code_snippets/Preferences">Code snippets:Preferences</a> (more detailed discussion with multiple examples)</li>
</ul>
<p>{{ languages( { "pl": "pl/API_Preferencji" } ) }}</p>
Revert to this revision