🔌 PluginRegistry

### Hierarchy

- BlueBaseModuleRegistry<ItemType, ItemInputType>
  - PluginRegistry

## Index

### Constructors

- constructor

### Properties

- BB
- data
- subscriptions

### Methods

- clear
- createItem
- delete
- disable
- enable
- entries
- filter
- filterValues
- findOne
- forEach
- generateKey
- get
- getKeyAnyItem
- getValue
- has
- hasConfig
- isEnabled
- isInputItem
- isInputValue
- isItem
- isValue
- keys
- preloadAll
- publish
- register
- registerCollection
- resolve
- set
- setValue
- size
- subscribe
- unsubscribe
- values

## Constructors

### constructor

- new PluginRegistry(BB: BlueBase): PluginRegistry

- Inherited from Registry.constructor

  - Defined in registries/Registry.ts:61

  #### Parameters

  - ##### BB: BlueBase

  #### Returns PluginRegistry

## Properties

### Protected BB

BB: BlueBase

Inherited from Registry.BB

- Defined in registries/Registry.ts:63

### Protected data

data: Map<string, ItemType> = new Map()

Inherited from Registry.data

- Defined in registries/Registry.ts:58

Internal data

### Protected subscriptions

subscriptions: Map<string, Map<string, RegistrySubscriptionFn<ItemType>>> = new Map()

Inherited from Registry.subscriptions

- Defined in registries/Registry.ts:61

List of subscriptions

## Methods

### clear

- clear(): void

- Inherited from Registry.clear

  - Defined in registries/Registry.ts:221

  The clear() method removes all elements from a Registry object.

  #### Returns void

### Protected createItem

- createItem(key: string, partial: any): ItemType

- Overrides BlueBaseModuleRegistry.createItem

  - Defined in registries/PluginRegistry.ts:206

  Convert any input value to an item. This is where you transform inputs and add defualts

  #### Parameters

  - ##### key: string

  - ##### partial: any

  #### Returns ItemType

### delete

- delete(key: string): boolean

- Inherited from Registry.delete

  - Defined in registries/Registry.ts:214

  The delete() method removes the specified element from a Registry object.

  #### Parameters

  - ##### key: string

  #### Returns boolean

### disable

- disable(key: string): Promise<void>

- - Defined in registries/PluginRegistry.ts:165

  Disable a plugin

  #### Parameters

  - ##### key: string

  #### Returns Promise<void>

### enable

- enable(key: string): Promise<void>

- - Defined in registries/PluginRegistry.ts:150

  Enable a plugin

  #### Parameters

  - ##### key: string

  #### Returns Promise<void>

### entries

- entries(): IterableIterator<Object>

- Inherited from Registry.entries

  - Defined in registries/Registry.ts:230

  The entries() method returns a new Iterator object that contains the [key, value] pairs for each element in the Registry object in insertion order.

  #### Returns IterableIterator<Object>

### filter

- filter(predicate: function): object

- Inherited from Registry.filter

  - Defined in registries/Registry.ts:274

  Filter registry items by a predicate function.

  #### Parameters

  - ##### predicate: function

    - - (value: ItemType["value"], key: string, item: ItemType): boolean

      - #### Parameters

        - ##### value: ItemType["value"]

        - ##### key: string

        - ##### item: ItemType

        #### Returns boolean

  #### Returns object

  - ##### [key: string]: ItemType

### filterValues

- filterValues(predicate: function): object

- Inherited from Registry.filterValues

  - Defined in registries/Registry.ts:291

  Filter registry items by a predicate function.

  #### Parameters

  - ##### predicate: function

    - - (value: ItemType["value"], key: string, item: ItemType): boolean

      - #### Parameters

        - ##### value: ItemType["value"]

        - ##### key: string

        - ##### item: ItemType

        #### Returns boolean

  #### Returns object

  - ##### [key: string]: ItemType

### Protected findOne

- findOne(...keys: string[]): undefined | ItemType

- Inherited from Registry.findOne

  - Defined in registries/Registry.ts:428

  Find one item in a given sequence. Returns the first item found.

  #### Parameters

  - ##### Rest ...keys: string[]

  #### Returns undefined | ItemType

### forEach

- forEach(callbackfn: function, thisArg?: any): void

- Inherited from Registry.forEach

  - Defined in registries/Registry.ts:263

  The forEach() method executes a provided function once per each key/value pair in the Registry object, in insertion order.

  #### Parameters

  - ##### callbackfn: function

    - - (value: ItemType, key: string, map: Map<string, ItemType>): void

      - #### Parameters

        - ##### value: ItemType

        - ##### key: string

        - ##### map: Map<string, ItemType>

        #### Returns void

  - ##### Optional thisArg: any

  #### Returns void

### Protected generateKey

- generateKey(_item: ItemType | ItemType["value"] | ItemInputType | ItemInputType["value"]): string | undefined

- Inherited from Registry.generateKey

  - Defined in registries/Registry.ts:490

  This function is used to auto generate an item key

  #### Parameters

  - ##### _item: ItemType | ItemType["value"] | ItemInputType | ItemInputType["value"]

  #### Returns string | undefined

### get

- get(...keys: string[]): undefined | ItemType

- Inherited from Registry.get

  - Defined in registries/Registry.ts:71

  The get() method returns a specified registry item.

  #### Parameters

  - ##### Rest ...keys: string[]

  #### Returns undefined | ItemType

### Protected getKeyAnyItem

- getKeyAnyItem(item: ItemType | ItemType["value"] | ItemInputType | ItemInputType["value"]): object
- getKeyAnyItem(key: string, item: ItemType | ItemType["value"] | ItemInputType | ItemInputType["value"]): object

- Inherited from Registry.getKeyAnyItem

  - Defined in registries/Registry.ts:445

  Used internally by the register method. Since this function as many overloads, resolves final key and value params.

  #### Parameters

  - ##### item: ItemType | ItemType["value"] | ItemInputType | ItemInputType["value"]

  #### Returns object

  - ##### item: ItemType | ItemType["value"] | ItemInputType | ItemInputType["value"]

  - ##### key: string

- Inherited from Registry.getKeyAnyItem

  - Defined in registries/Registry.ts:448

  #### Parameters

  - ##### key: string

  - ##### item: ItemType | ItemType["value"] | ItemInputType | ItemInputType["value"]

  #### Returns object

  - ##### item: ItemType | ItemType["value"] | ItemInputType | ItemInputType["value"]

  - ##### key: string

### getValue

- getValue(...keys: string[]): ItemType["value"] | undefined

- Inherited from Registry.getValue

  - Defined in registries/Registry.ts:115

  The getValue() method returns a specified value from a Registry object.

  #### Parameters

  - ##### Rest ...keys: string[]

  #### Returns ItemType["value"] | undefined

### has

- has(key: string): boolean

- Inherited from Registry.has

  - Defined in registries/Registry.ts:206

  The has() method returns a boolean indicating whether an element with the specified key exists or not.

  #### Parameters

  - ##### key: string

  #### Returns boolean

### hasConfig

- hasConfig(key: string, config: string): boolean

- - Defined in registries/PluginRegistry.ts:186

  Checks if a config belongs to a plugin. Does so by checking 2 things:

  1. Does the config start with 'plugin.{key}.'?
  2. Does the config exist in defaultConfigs property of the plugin?

  Returns true if any of the above are true, otherwise returns false

  #### Parameters

  - ##### key: string

  - ##### config: string

  #### Returns boolean

### isEnabled

- isEnabled(key: string): boolean

- - Defined in registries/PluginRegistry.ts:134

  Checks if a plugin is enabled

  #### Parameters

  - ##### key: string

  #### Returns boolean

### Protected isInputItem

- isInputItem(item: any): boolean

- Inherited from Registry.isInputItem

  - Defined in registries/Registry.ts:405

  Typeguard to check a given object is a input item

  #### Parameters

  - ##### item: any

  #### Returns boolean

### Protected isInputValue

- isInputValue(value: any): boolean

- Overrides BlueBaseModuleRegistry.isInputValue

  - Defined in registries/PluginRegistry.ts:221

  Typeguard to check a given object is an input value

  #### Parameters

  - ##### value: any

  #### Returns boolean

### Protected isItem

- isItem(item: any): boolean

- Inherited from Registry.isItem

  - Defined in registries/Registry.ts:397

  Typeguard to check a given object is a registry item

  #### Parameters

  - ##### item: any

  #### Returns boolean

### Protected isValue

- isValue(value: any): boolean

- Inherited from BlueBaseModuleRegistry.isValue

  Overrides Registry.isValue

  - Defined in registries/BlueBaseModuleRegistry.ts:123

  Typeguard to check a given object is a registry value

  #### Parameters

  - ##### value: any

  #### Returns boolean

### keys

- keys(): IterableIterator<string>

- Inherited from Registry.keys

  - Defined in registries/Registry.ts:238

  The keys() method returns a new Iterator object that contains the keys for each element in the Registry object in insertion order.

  #### Returns IterableIterator<string>

### preloadAll

- preloadAll(): Promise<any[]>

- Inherited from BlueBaseModuleRegistry.preloadAll

  - Defined in registries/BlueBaseModuleRegistry.ts:95

  Preload all items that have preload property set to true

  #### Returns Promise<any[]>

### Protected publish

- publish(key: string, item: ItemType): void

- Inherited from Registry.publish

  - Defined in registries/Registry.ts:414

  Publishes updates of a config value change to all the subscribers

  #### Parameters

  - ##### key: string

  - ##### item: ItemType

  #### Returns void

### register

- register(item: ItemType | ItemType["value"] | ItemInputType | ItemInputType["value"]): Promise<string>
- register(key: string, item: ItemType | ItemType["value"] | ItemInputType | ItemInputType["value"]): Promise<string>

- Inherited from BlueBaseModuleRegistry.register

  Overrides Registry.register

  - Defined in registries/BlueBaseModuleRegistry.ts:75

  Adds an Item or an Item value to the registry. If the item is a BlueBaseModule, it is resolved first.

  #### Parameters

  - ##### item: ItemType | ItemType["value"] | ItemInputType | ItemInputType["value"]

  #### Returns Promise<string>

- Inherited from BlueBaseModuleRegistry.register

  Overrides Registry.register

  - Defined in registries/BlueBaseModuleRegistry.ts:78

  #### Parameters

  - ##### key: string

  - ##### item: ItemType | ItemType["value"] | ItemInputType | ItemInputType["value"]

  #### Returns Promise<string>

### registerCollection

- registerCollection(collection?: ItemCollection<ItemInputType>): Promise<void>

- Inherited from Registry.registerCollection

  - Defined in registries/Registry.ts:180

  Register a collection of items.

  #### Parameters

  - ##### Default value collection: ItemCollection<ItemInputType> = []

  #### Returns Promise<void>

### resolve

- resolve(...keys: string[]): Promise<Plugin>

- - Defined in registries/PluginRegistry.ts:118

  Returns a Promise that resolves a Plugin

  #### Parameters

  - ##### Rest ...keys: string[]

  #### Returns Promise<Plugin>

### set

- set(key: string, item: ItemType | ItemInputType): this

- Inherited from BlueBaseModuleRegistry.set

  Overrides Registry.set

  - Defined in registries/BlueBaseModuleRegistry.ts:65

  The set() method adds or updates an element with a specified key and item to the registry.

  #### Parameters

  - ##### key: string

  - ##### item: ItemType | ItemInputType

  #### Returns this

### setValue

- setValue(key: string, value: ItemType["value"] | ItemInputType["value"]): this

- Inherited from Registry.setValue

  - Defined in registries/Registry.ts:134

  The setValue() method adds or updates the value a registry item with the specified key.

  #### Parameters

  - ##### key: string

  - ##### value: ItemType["value"] | ItemInputType["value"]

  #### Returns this

### size

- size(): number

- Inherited from Registry.size

  - Defined in registries/Registry.ts:253

  Returns the number of items in the Registry.

  #### Returns number

### subscribe

- subscribe(key: string, callback: RegistrySubscriptionFn<ItemType>): string

- Inherited from Registry.subscribe

  - Defined in registries/Registry.ts:312

  Subscribe to a config value update

  #### Parameters

  - ##### key: string

    Config key

  - ##### callback: RegistrySubscriptionFn<ItemType>

    Callback function

  #### Returns string

  Subscription ID

### unsubscribe

- unsubscribe(key: string, subscriptionId: string): void

- Inherited from Registry.unsubscribe

  - Defined in registries/Registry.ts:337

  Unsubscribe from a config value update

  #### Parameters

  - ##### key: string

    Config key

  - ##### subscriptionId: string

    Subscription ID

  #### Returns void

### values

- values(): IterableIterator<ItemType>

- Inherited from Registry.values

  - Defined in registries/Registry.ts:246

  The values() method returns a new Iterator object that contains the values for each element in the Registry object in insertion order.

  #### Returns IterableIterator<ItemType>

Generated using TypeDoc