Class: PluginSystem<T, B>
Defined in: src/sdk/components/FSComponent.ts:1249
A system that handles the registration and boostrapping of plugin scripts.
Type Parameters
| Type Parameter |
|---|
T extends AvionicsPlugin<B> |
B |
Constructors
Constructor
new PluginSystem<
T,B>():PluginSystem<T,B>
Defined in: src/sdk/components/FSComponent.ts:1272
Ctor
Returns
PluginSystem<T, B>
Properties
binder?
optionalbinder:B
Defined in: src/sdk/components/FSComponent.ts:1254
The avionics specific plugin binder to inject into each plugin.
createdHandlers
readonlycreatedHandlers: (component) =>void[] =[]
Defined in: src/sdk/components/FSComponent.ts:1260
An event subscribable that publishes when a new component is created.
Parameters
| Parameter | Type |
|---|---|
component | DisplayComponent<any> |
Returns
void
creatingHandlers
readonlycreatingHandlers: (constructor,props) =>undefined|DisplayComponent<any, []>[] =[]
Defined in: src/sdk/components/FSComponent.ts:1257
An event subscribable that publishes when a new component is about to be created.
Parameters
| Parameter | Type |
|---|---|
constructor | DisplayComponentFactory<any> |
props | any |
Returns
undefined | DisplayComponent<any, []>
renderedHandlers
readonlyrenderedHandlers: (node) =>void[] =[]
Defined in: src/sdk/components/FSComponent.ts:1263
An event subscribable that publishes when a component has finished rendering.
Parameters
| Parameter | Type |
|---|---|
node | VNode |
Returns
void
Methods
addPlugin()
addPlugin(
plugin):void
Defined in: src/sdk/components/FSComponent.ts:1369
Adds a plugin to the plugin system.
Parameters
| Parameter | Type | Description |
|---|---|---|
plugin | T | The plugin to add. |
Returns
void
addScripts()
addScripts(
document,instrumentId,globalPluginTargetFunc):Promise<void>
Defined in: src/sdk/components/FSComponent.ts:1290
Adds plugin scripts to load to the system.
Parameters
| Parameter | Type | Description |
|---|---|---|
document | XMLDocument | The panel.xml document to load scripts from. |
instrumentId | string | The ID of the instrument. |
globalPluginTargetFunc | (target) => boolean | A function that returns true if a global plugin should be loaded. |
Returns
Promise<void>
Example
await this.pluginSystem.addScripts(this.instrument.xmlConfig, this.instrument.templateID, (target) => {
return target === this.instrument.templateID;
});
callPlugins()
callPlugins(
fun,reverseOrder):void
Defined in: src/sdk/components/FSComponent.ts:1378
Runs the provided function on all of the registered plugins.
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
fun | (plugin) => void | undefined | The function to run. |
reverseOrder | boolean | false | Whether to iterate through plugins in reverse order. Defaults to false. |
Returns
void
onComponentCreated()
onComponentCreated(
component):void
Defined in: src/sdk/components/FSComponent.ts:1428
A hook that allows plugins to observe components as they are created.
Parameters
| Parameter | Type | Description |
|---|---|---|
component | DisplayComponent<any> | The component that was created. |
Returns
void
onComponentCreating()
onComponentCreating(
constructor,props):undefined|DisplayComponent<any, []>
Defined in: src/sdk/components/FSComponent.ts:1404
A hook that allows plugins to replace components that are about to be created with their own implementations.
Parameters
| Parameter | Type | Description |
|---|---|---|
constructor | DisplayComponentFactory<any> | The display component constructor that is going to be used. |
props | any | The component props that will be passed into the component. |
Returns
undefined | DisplayComponent<any, []>
Returns either the display component that will replace, or undefined if the component should not be replaced.
onComponentRendered()
onComponentRendered(
node):void
Defined in: src/sdk/components/FSComponent.ts:1446
A hook that allows plugins to observe built VNodes after they are rendered.
Parameters
| Parameter | Type | Description |
|---|---|---|
node | VNode | The node that was rendered. |
Returns
void
startSystem()
startSystem(
binder):Promise<void>
Defined in: src/sdk/components/FSComponent.ts:1340
Starts the plugin system with the included avionics specific plugin binder.
Parameters
| Parameter | Type | Description |
|---|---|---|
binder | B | The plugin binder to pass to the individual plugins. |
Returns
Promise<void>
subscribeOnComponentCreated()
subscribeOnComponentCreated(
handler):void
Defined in: src/sdk/components/FSComponent.ts:1420
Subscribes a handler to the component created hook.
Parameters
| Parameter | Type | Description |
|---|---|---|
handler | (component) => void | The handler to subscribe. |
Returns
void
subscribeOnComponentCreating()
subscribeOnComponentCreating(
handler):void
Defined in: src/sdk/components/FSComponent.ts:1394
Subscribes a handler to the component creating hook.
Parameters
| Parameter | Type | Description |
|---|---|---|
handler | (constructor, props) => undefined | DisplayComponent<any, []> | The handler to subscribe. |
Returns
void
subscribeOnComponentRendered()
subscribeOnComponentRendered(
handler):void
Defined in: src/sdk/components/FSComponent.ts:1438
Subscribes a handler to the component rendered hook.
Parameters
| Parameter | Type | Description |
|---|---|---|
handler | (node) => void | The handler to subscribe. |
Returns
void