Class: BasePreferences

BasePreferences()

BasePreferences - Abstract base class for storing persistent settings. Used for settings that should be applied to all opened documents, or every time the viewer is loaded.

Constructor

new BasePreferences()

Source:

Methods

(async) _readFromStorage(prefObj) → {Promise}

Stub function for reading preferences from storage.
Parameters:
Name Type Description
prefObj Object The preferences that should be read from storage.
Source:
Returns:
A promise that is resolved with an {Object} containing the preferences that have been read.
Type
Promise

(async) _writeToStorage(prefObj) → {Promise}

Stub function for writing preferences to storage.
Parameters:
Name Type Description
prefObj Object The preferences that should be written to storage.
Source:
Returns:
A promise that is resolved when the preference values have been written.
Type
Promise

(async) get(name) → {Promise}

Get the value of a preference.
Parameters:
Name Type Description
name string The name of the preference whose value is requested.
Source:
Returns:
A promise resolved with a {boolean|number|string} containing the value of the preference.
Type
Promise

(async) getAll() → {Promise}

Get the values of all preferences.
Source:
Returns:
A promise that is resolved with an {Object} containing the values of all preferences.
Type
Promise

(async) reset() → {Promise}

Reset the preferences to their default values and update storage.
Source:
Returns:
A promise that is resolved when the preference values have been reset.
Type
Promise

(async) set(name, value) → {Promise}

Set the value of a preference.
Parameters:
Name Type Description
name string The name of the preference that should be changed.
value boolean | number | string The new value of the preference.
Source:
Returns:
A promise that is resolved when the value has been set, provided that the preference exists and the types match.
Type
Promise