Skip to content

Latest commit

 

History

History
41 lines (29 loc) · 1.89 KB

SettingsAPI.md

File metadata and controls

41 lines (29 loc) · 1.89 KB
layout
default

{% include links %}

  • TOC {:toc}

SeLite Settings API

Operate SeLite Settings-managed configurations through API. See its source. In [Core extensions][core extension] access it through object SeLiteSettings. In other scopes, e.g. Selenium [IDE extensions][ide extension] or code modules (as per {{navJavascriptCodeModules}}), call

Components.utils.import("chrome://selite-settings/content/SeLiteSettings.js");

Defining a configuration module

Define a configuration module (schema) in a Javascript file (in UTF-8). See test_settings_module.js as an example. Instantiate

  • subclasses of SeLiteSettings.Field, one instance per field
  • class SeLiteSettings.Module, one instance per module

The definition must be

  • on the filesystem (possibly a network drive), referenced by its path or file:// URL; or
  • in a custom Firefox extension (at {{chromeUrl}} or resource:// URL)

Whenever you update a module definition, you need to either

  • refresh it via url chrome://selite-settings/content/tree.xul, and restart any depending extensions (such as Selenium IDE); or
  • restart Firefox.

Registering and loading a module programatically

Use SeLiteSettings.loadFromJavascript() to load or register & load a module programatically. You don't need this if you register the configuration file via SettingsInterface.

Reading values

See class SeLiteSettings.Module and its methods

  • getFieldsOfSet() - primarily for modules that have associatesWithFolders==false
  • getFieldsDownToFolder() - only for modules that have associatesWithFolders==true

Updating preferences

See class SeLiteSettings.Field and its methods setValue(), addValue() and removeValue().