Methods
getArgumentValues() → {Promise.<Array.<any>>}
Get the current argument values of this card, as filled in by the user.
Returns:
- Type:
-
Promise.<Array.<any>>
A Promise that resolves to an array of key-value objects with the argument's name as key. Every array entry represents one Flow card.
registerArgumentAutocompleteListener(name, listener) → {FlowCard}
Register a listener for a autocomplete event of a specific flow card argument.
This is fired when the argument is of type autocomplete
and the user typed a query.
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
name |
string
|
name of the desired flow card argument. |
|||||||||
listener |
function
|
Should return a promise that resolves to the autocomplete results.
|
Returns:
- Type:
-
FlowCard
Example
const myActionCard = this.homey.flow.getActionCard('my_action');
myActionCard.registerArgumentAutocompleteListener('my_arg', async (query, args) => {
const results = [
{
name: 'Value name',
description: 'Optional description',
icon: 'https://path.to/icon.svg',
// For images that are not svg use:
// image: 'https://path.to/icon.png',
// You can freely add additional properties to access in registerRunListener
id: '...',
},
];
// filter based on the query
return results.filter((result) => {
return result.name.toLowerCase().includes(query.toLowerCase());
});
});
registerRunListener(listener) → {FlowCard}
Register a listener for a run event.
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
listener |
function
|
Should return a promise that resolves to the FlowCards run result
|
Returns:
- Type:
-
FlowCard
Events
.on('update')
This event is fired when the card is updated by the user (e.g. a Flow has been saved).