Options
All
  • Public
  • Public/Protected
  • All
Menu

Class SettingRegistry

The default concrete implementation of a setting registry. A namespace for SettingRegistry statics.

Hierarchy

  • SettingRegistry

Implements

Index

Constructors

constructor

Properties

Private _pluginChanged

_pluginChanged: Signal<this, string> = new Signal<this, string>(this)

Private _ready

_ready: Promise<void> = Promise.resolve()

Private _timeout

_timeout: number

Private _transformers

_transformers: object = Object.create(null)

Type declaration

  • [plugin: string]: object

connector

connector: IDataConnector<IPlugin, string, string>

The data connector used by the setting registry.

plugins

plugins: object = Object.create(null)

The collection of setting registry plugins.

Type declaration

schema

schema: ISchema = SCHEMA as ISettingRegistry.ISchema

The schema of the setting registry.

validator

validator: ISchemaValidator

The schema validator used by the setting registry.

Accessors

pluginChanged

  • get pluginChanged(): ISignal<this, string>
  • A signal that emits the name of a plugin when its settings change.

    Returns ISignal<this, string>

Methods

Private _load

  • _load(data: IPlugin): Promise<void>

Private _preload

  • _preload(plugins: IPlugin[]): Promise<void>

Private _save

  • _save(plugin: string): Promise<void>
  • Save a plugin in the registry.

    Parameters

    • plugin: string

    Returns Promise<void>

Private _transform

Private _validate

  • _validate(plugin: IPlugin): Promise<void>

get

  • get(plugin: string, key: string): Promise<object>
  • Get an individual setting.

    Parameters

    • plugin: string

      The name of the plugin whose settings are being retrieved.

    • key: string

      The name of the setting being retrieved.

    Returns Promise<object>

    A promise that resolves when the setting is retrieved.

load

  • Load a plugin's settings into the setting registry.

    Parameters

    • plugin: string

      The name of the plugin whose settings are being loaded.

    Returns Promise<ISettings>

    A promise that resolves with a plugin settings object or rejects if the plugin is not found.

reload

  • Reload a plugin's settings into the registry even if they already exist.

    Parameters

    • plugin: string

      The name of the plugin whose settings are being reloaded.

    Returns Promise<ISettings>

    A promise that resolves with a plugin settings object or rejects with a list of ISchemaValidator.IError objects if it fails.

remove

  • remove(plugin: string, key: string): Promise<void>
  • Remove a single setting in the registry.

    Parameters

    • plugin: string

      The name of the plugin whose setting is being removed.

    • key: string

      The name of the setting being removed.

    Returns Promise<void>

    A promise that resolves when the setting is removed.

set

  • set(plugin: string, key: string, value: JSONValue): Promise<void>
  • Set a single setting in the registry.

    Parameters

    • plugin: string

      The name of the plugin whose setting is being set.

    • key: string

      The name of the setting being set.

    • value: JSONValue

      The value of the setting being set.

    Returns Promise<void>

    A promise that resolves when the setting has been saved.

transform

  • transform(plugin: string, transforms: object): IDisposable
  • Register a plugin transform function to act on a specific plugin.

    Parameters

    • plugin: string

      The name of the plugin whose settings are transformed.

    • transforms: object

      The transform functions applied to the plugin.

    Returns IDisposable

    A disposable that removes the transforms from the registry.

    Notes

    • compose transformations: The registry automatically overwrites a plugin's default values with user overrides, but a plugin may instead wish to merge values. This behavior can be accomplished in a compose transformation.
    • fetch transformations: The registry uses the plugin data that is fetched from its connector. If a plugin wants to override, e.g. to update its schema with dynamic defaults, a fetch transformation can be applied.

upload

  • upload(plugin: string, raw: string): Promise<void>
  • Upload a plugin's settings.

    Parameters

    • plugin: string

      The name of the plugin whose settings are being set.

    • raw: string

      The raw plugin settings being uploaded.

    Returns Promise<void>

    A promise that resolves when the settings have been saved.

Static reconcileShortcuts

  • Reconcile default and user shortcuts and return the composite list.

    Parameters

    • defaults: IShortcut[]

      The list of default shortcuts.

    • user: IShortcut[]

      The list of user shortcut overrides and additions.

    Returns IShortcut[]

    A loadable list of shortcuts (omitting disabled and overridden).

Generated using TypeDoc