"settings_define" Allows the user to customize settings for your scripts. Right now, only checkbox and text are allowed.
If you change a setting internally, you can send settings_define(...)
again to notify Flow of the change.
- Return a structure of the options.
this.store = {
script_enabled: true,
intro_message: false,
outro_message: 'hello!',
message_color: '#FF66FFFF',
}
settings_define({
intro_message: {
type: 'checkbox',
label: 'Option 1 label',
value: this.store.intro_message,
description: 'This is a description text (totally optional)',
changed: (value) => {
this.store.intro_message = value;
this.$api.datastore.export(this.store);
// Any code you want to execute when the option is changed
}
},
outro_message: {
type: 'text',
label: 'Option 2 label',
value: this.store.outro_message,
description: 'This is a text box!',
changed: (value) => {
this.store.outro_message = value;
this.$api.datastore.export(this.store);
// Any code you want to execute when the option is changed
}
},
message_color: {
type: 'color',
label: 'Option3 label',
value: this.store.message_color,
description: 'This is a color selector!',
changed: (value) => {
this.store.message_color = value;
this.$api.datastore.export(this.store);
// Any code you want to execute when the option is changed
}
}
})