ComponentRegistry

Summary

The ComponentRegistry maintains an index of React components registered by Mailspring packages. Components can use {InjectedComponent} and {InjectedComponentSet} to dynamically render components registered with the ComponentRegistry.

Instance Methods

register(componentoptions)

Register a new component with the Component Registry. Typically, packages call this method from their main `activate` method to extend the Mailspring user interface, and call the corresponding `unregister` method in `deactivate`. This method is chainable.

Parameters

Argument Description
component {Object} A React Component with a `displayName`
options {Object}: Note that for advanced use cases, you can also pass (`modes`, `roles`, `locations`) with arrays instead of single values.

findComponentByName(name)

Retrieve the registry entry for a given name.

Parameters

Argument Description
name The {String} name of the registered component to retrieve.

Returns

Return Values
Returns a {React.Component}

findComponentsMatching(descriptor)

Retrieve all of the registry entries matching a given descriptor. ```coffee ComponentRegistry.findComponentsMatching({ role: 'Composer:ActionButton' }) ComponentRegistry.findComponentsMatching({ location: WorkspaceStore.Location.RootSidebar.Toolbar }) ```

Parameters
Argument Description
descriptor An {Object} that specifies set of components using the available keys below. Note that for advanced use cases, you can also pass (`modes`, `roles`, `locations`) with arrays instead of single values.

Returns

Return Values
Returns an {Array} of {React.Component} objects

results matching ""

    No results matching ""