Selectors

You can obtain information about plugins.

Copy
{
  "name": "...",
  "orion": {
    "selectorsHelper": {
      "selectorFactories": {
        "consumes": {
          "@orion/core": [
            "existsPlugin",
            "getAllPluginsName",
            "getPlugin",
            "getPluginProperty",
            "isPluginOn",
            "isPluginPrefersOn",
            "getAllPluginsByPriority"
          ]
        }
      }
    }
  }
}

existsPlugin

Returns true if a plugin exists. It does not need to exist (is not added), returns false.

Usage
Copy
const existsPlugin = selectorsHelper.make('existsPlugin');
const result = existsPlugin(storeHelper.getState(), { pluginName });
  • pluginName: String

    The name of the string to verify existence.

Returns
  • boolean

    It returns true if the plugin exists, or false if not.

getAllPluginsName

Returns a list with the name of all plugins.

Usage
Copy
const getAllPluginsName = selectorsHelper.make('getAllPluginsName');
const result = getAllPluginsName(storeHelper.getState());
Returns
  • [string]

    The list of all plugin names.

getPlugin

Returns the plugin metadata for a given plugin name.

Usage
Copy
const getPlugin = selectorsHelper.make('getPlugin');
const result = getPlugin(storeHelper.getState(), { pluginName });
  • pluginName: String

    The name of the plugin to obtain the metadata

Returns
  • PluginMetadata | undefined

    The object with the available plugin metadata.

getPluginProperty

Returns a property of a plugin.

Usage
Copy
const getPluginProperty = selectorsHelper.make('getPluginProperty');
const result = getPluginProperty(storeHelper.getState(), { pluginName, property });
  • pluginName: String

    The name of the plugin to obtain data

  • property: String

    The name of the field to read

Returns

  • any

    The corresponding value of the metadata property

isPluginOn

Returns if the given plugin is running.

Usage
Copy
const isPluginOn = selectorsHelper.make('isPluginOn');
const result = isPluginOn(storeHelper.getState(), { pluginName });
  • pluginName: String

    The name of the plugin to query

Returns
  • boolean

    It returns true if the plugin is running, false otherwise.

isPluginPrefersOn

It queries if a plugin prefers to be running or not, independently if it is running or not.

Usage
Copy
const isPluginPrefersOn = selectorsHelper.make('isPluginPrefersOn');
const result = isPluginPrefersOn(storeHelper.getState(), { pluginName });
  • pluginName: String

    The name of the plugin to query

Returns
  • boolean

    It returns true if the plugin prefers to be running, false otherwise

getAllPluginsByPriority

Returns a list of all plugins metadata sorted by priority.

Usage
Copy
const getAllPluginsByPriority = selectorsHelper.make('getAllPluginsByPriority');
const result = getAllPluginsByPriority(storeHelper.getState());
Returns
  • [Metadata]

    The list of all plugin metadata.