Settings
Using Settings
To add settings to your plugin, you need to create a file called SettingsTemplate.yaml. You can read more about it
in the documentation. For now, let’s create a simple settings
file for specifying the city we want to look up the weather for.
body: - type: input attributes: name: city label: "Enter the city you'd like to look up the weather for:" defaultValue: New YorkThat’s it, now your settings are available in the Plugins tab in Flow Launcher settings:
You can access them using the settings property of your class:
@FlowPlugin.Classexport class MyPlugin extends FlowPlugin { @FlowPlugin.Init myInitMethod() { this.settings.city; // "New York" }}@FlowPlugin.Classexport class MyPlugin extends FlowPlugin { @FlowPlugin.Init myInitMethod() { this.settings.city; // "New York" }}Specifying Settings Type
You might want to specify the structure of the settings object so that you can get suggestions from your IDE when
working with it. If you don’t want to, you can skip this section. You can specify the type like this:
/** * @typedef {object} MySettings * @property {string} city */ /** @extends {FlowPlugin<MySettings>} */@FlowPlugin.Classexport class MyPlugin extends FlowPlugin {}type MySettings = { city: string;}
@FlowPlugin.Classexport class MyPlugin extends FlowPlugin<MySettings> {}