Skip to content
On this page

EnginePlugin Interface Documentation

The EnginePlugin interface allows developers to integrate custom plugins into the Visiontree FHIR engine. These plugins can be used to intercept various engine events, enabling enhanced functionalities and behaviors.


Overview

Through the EnginePlugin, developers have the ability to extend and customize the engine's behavior at various lifecycle points, such as initialization, form loading, saving, and more.


Properties

name

typescript
name?: string

An optional name for the plugin. If not provided, a unique identifier will be generated.


Methods

onLoad

typescript
(this: EngineAPI) => void

Invoked when the plugin has been loaded into the engine.


onInit

typescript
(this: EngineAPI) => void | Promise<unknown>

Called before the engine's initialization process.


onReady

typescript
(this: EngineAPI) => void

Invoked after the engine has completed its initialization.


onFormLoad

typescript
(this: EngineAPI, form: Form) => void

Triggered when the engine loads a Questionnaire resource. This method provides an opportunity to modify the form before it is displayed.


onFormSave

typescript
(this: EngineAPI, questionnaireResponse: r4.QuestionnaireResponse) => Promise<unknown>

Called when a save event is initiated for a form. It handles the creation or modification of a QuestionnaireResponse.


onFormChange

typescript
(this: EngineAPI, questionnaireResponse: r4.QuestionnaireResponse) => void

Invoked whenever there's a change in a form's QuestionnaireResponse. Useful for tracking form alterations or user inputs.


Conclusion

The EnginePlugin interface offers a powerful way to extend the Visiontree FHIR engine's functionalities. By understanding its methods and lifecycle hooks, developers can create custom plugins that seamlessly integrate with the engine, enhancing its behavior and capabilities.