Skip to content

Initialization

When Do I Need It?

You need it if your plugin needs to do some setup before it can be used. For example, if your plugin needs to preload a file into memory, download some data from the internet, or just generate some data that will be used later, you can use the Init attribute.

How Do I Use It?

Define a method in your plugin class and add a @FlowPlugin.Init decorator before it. The method you define must not return anything. The method can be marked as async if you need to perform asynchronous operations.

index.js
@FlowPlugin.Class
export class MyPlugin extends FlowPlugin {
@FlowPlugin.Init
async myInitMethod() {
// Do something async here
}
}