FlotiqPluginsRegistry¶
class FlotiqPluginsRegistry¶
Main class for handling Flotiq plugins. It is responsible for registering, running and managing plugins.
A global instance of this class is available as window.FlotiqPlugins.
Properties
| Name | Type | Description |
|---|---|---|
spaceId |
string|null|undefined |
Space ID where the plugins are operating |
router |
Router|null|undefined |
Router instance used for navigation within the app |
queryClient |
QueryClient|undefined |
Query client instance for managing fetch caches |
add |
add | Register new plugin. If plugin with given ID already exists, it will be unregistered first. |
run |
run | Execute all handlers for an event. Event name and parameters must be paired correctly. |
runScoped |
runScoped | Execute all handlers for an event for the given plugin. Event name and parameters must be paired correctly. |
unregister |
unregister | Unregister plugin event handlers by id. |
unregisterAllPlugins |
unregisterAllPlugins | Unregister plugin event handlers by id. |
function add¶
Register new plugin. If plugin with given ID already exists, it will be unregistered first.
Returns
- void
Parameters
| Name | Type | Description |
|---|---|---|
pluginInfo |
FlotiqPluginInfo | |
callback |
FlotiqPluginAddCallback |
function FlotiqPluginAddCallback¶
A callback function that will be called when plugin is registered and started. This callback should register all event handlers for the plugin.
Returns
- void
Parameters
| Name | Type | Description |
|---|---|---|
eventHandler |
PluginEventHandler | |
client |
FlotiqPluginApiClient | |
globals |
FlotiqGlobals |
function run¶
Execute all handlers for an event. Event name and parameters must be paired correctly.
Returns
- any[]
Array of results returned by the executed handlers.
Parameters
| Name | Type | Description |
|---|---|---|
event |
string |
An event name to run. Only specified plugin handlers of this event will be executed. |
params |
any[] |
Parameters to pass to the handlers. |
function runScoped¶
Execute all handlers for an event for the given plugin. Event name and parameters must be paired correctly.
Returns
- any[]
Array of results returned by the executed handlers.
Parameters
| Name | Type | Description |
|---|---|---|
event |
string |
An event name to run. Only specified plugin handlers of this event will be executed. |
pluginId |
string |
Plugin id to run the event for |
params |
any[] |
Parameters to pass to the handlers. |
function unregister¶
Unregister plugin event handlers by id.
Returns
- void
Parameters
| Name | Type | Description |
|---|---|---|
pluginId |
string |
The id of the plugin that should be unregistered from the plugin list |
function unregisterAllPlugins¶
Unregister plugin event handlers by id.
Returns
- void