Class: PluginSystem<T, B>
A system that handles the registration and boostrapping of plugin scripts.
Type parameters
Name | Type |
---|---|
T | extends AvionicsPlugin <B > |
B | B |
Constructors
constructor
• new PluginSystem<T
, B
>(): PluginSystem
<T
, B
>
Ctor
Type parameters
Name | Type |
---|---|
T | extends AvionicsPlugin <B > |
B | B |
Returns
PluginSystem
<T
, B
>
Defined in
src/sdk/components/FSComponent.ts:1242
Properties
binder
• Optional
binder: B
The avionics specific plugin binder to inject into each plugin.
Defined in
src/sdk/components/FSComponent.ts:1224
createdHandlers
• Readonly
createdHandlers: (component
: DisplayComponent
<any
, []>) => void
[] = []
An event subscribable that publishes when a new component is created.
Defined in
src/sdk/components/FSComponent.ts:1230
creatingHandlers
• Readonly
creatingHandlers: (constructor
: DisplayComponentFactory
<any
, []>, props
: any
) => undefined
| DisplayComponent
<any
, []>[] = []
An event subscribable that publishes when a new component is about to be created.
Defined in
src/sdk/components/FSComponent.ts:1227
renderedHandlers
• Readonly
renderedHandlers: (node
: VNode
) => void
[] = []
An event subscribable that publishes when a component has finished rendering.
Defined in
src/sdk/components/FSComponent.ts:1233
Methods
addPlugin
▸ addPlugin(plugin
): void
Adds a plugin to the plugin system.
Parameters
Name | Type | Description |
---|---|---|
plugin | T | The plugin to add. |
Returns
void
Defined in
src/sdk/components/FSComponent.ts:1339
addScripts
▸ addScripts(document
, instrumentId
, globalPluginTargetFunc
): Promise
<void
>
Adds plugin scripts to load to the system.
Parameters
Name | Type | Description |
---|---|---|
document | XMLDocument | The panel.xml document to load scripts from. |
instrumentId | string | The ID of the instrument. |
globalPluginTargetFunc | (target : string ) => 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;
});
Defined in
src/sdk/components/FSComponent.ts:1260
callPlugins
▸ callPlugins(fun
): void
Runs the provided function on all of the registered plugins.
Parameters
Name | Type | Description |
---|---|---|
fun | (plugin : T ) => void | The function to run. |
Returns
void
Defined in
src/sdk/components/FSComponent.ts:1347
onComponentCreated
▸ onComponentCreated(component
): void
A hook that allows plugins to observe components as they are created.
Parameters
Name | Type | Description |
---|---|---|
component | DisplayComponent <any , []> | The component that was created. |
Returns
void
Defined in
src/sdk/components/FSComponent.ts:1391
onComponentCreating
▸ onComponentCreating(constructor
, props
): undefined
| DisplayComponent
<any
, []>
A hook that allows plugins to replace components that are about to be created with their own implementations.
Parameters
Name | 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.
Defined in
src/sdk/components/FSComponent.ts:1367
onComponentRendered
▸ onComponentRendered(node
): void
A hook that allows plugins to observe built VNodes after they are rendered.
Parameters
Name | Type | Description |
---|---|---|
node | VNode | The node that was rendered. |
Returns
void
Defined in
src/sdk/components/FSComponent.ts:1409
startSystem
▸ startSystem(binder
): Promise
<void
>
Starts the plugin system with the included avionics specific plugin binder.
Parameters
Name | Type | Description |
---|---|---|
binder | B | The plugin binder to pass to the individual plugins. |
Returns
Promise
<void
>
Defined in
src/sdk/components/FSComponent.ts:1310
subscribeOnComponentCreated
▸ subscribeOnComponentCreated(handler
): void
Subscribes a handler to the component created hook.
Parameters
Name | Type | Description |
---|---|---|
handler | (component : DisplayComponent <any , []>) => void | The handler to subscribe. |
Returns
void
Defined in
src/sdk/components/FSComponent.ts:1383
subscribeOnComponentCreating
▸ subscribeOnComponentCreating(handler
): void
Subscribes a handler to the component creating hook.
Parameters
Name | Type | Description |
---|---|---|
handler | (constructor : DisplayComponentFactory <any , []>, props : any ) => undefined | DisplayComponent <any , []> | The handler to subscribe. |
Returns
void
Defined in
src/sdk/components/FSComponent.ts:1357
subscribeOnComponentRendered
▸ subscribeOnComponentRendered(handler
): void
Subscribes a handler to the component rendered hook.
Parameters
Name | Type | Description |
---|---|---|
handler | (node : VNode ) => void | The handler to subscribe. |
Returns
void
Defined in
src/sdk/components/FSComponent.ts:1401