AbstractMessageAction
Class
The abstract base class for MessageAction
. To create a custom message action, extend from this class.
Implements
Constructors
constructor
Class Constructornew AbstractMessageAction(options: MessageActionConstructorOptions): AbstractMessageAction
Parameters
Parameter | Type |
---|---|
options | MessageActionConstructorOptions |
Returns
AbstractMessageAction
Properties
Property | Type | Notes |
---|---|---|
string | The unique id of the action. For actions provided by a widget, the id is: widgetId + actionName. | |
string | The action label. To support i18n, use | |
string | The action name. | |
string | The widget id that provides the action. If a widget id is not provided, the action is provided by the Jimu framework. |
Methods
Method | Returns | Notes |
---|---|---|
destroy() | void | When a widget is removed, actions provided by this widget will be destroyed. |
filterMessage(message) | boolean | This indicates whether a specific message can trigger the filter message action. This method is used to filter messages in the message manager. |
filterMessageDescription(messageDescription) | boolean | This indicates whether or not the type of message can trigger the filter message action. This method is used in builder to filter the available actions. |
onExecute(message, actionConfig?) | boolean | Promise<boolean> | The execution of the action when the message is matched. |
onRemoveListen(messageType, messageWidgetId?) | void | When an action is removed from a message's listener, this function will be invoked. |
destroy
Class Methoddestroy(): void
When a widget is removed, actions provided by this widget will be destroyed.
Returns
void
filterMessage
filterMessage(message: Message): boolean
This indicates whether a specific message can trigger the filter message action. This method is used to filter messages in the message manager.
Parameters
Parameter | Type |
---|---|
message | Message |
Returns
boolean
filterMessageDescription
filterMessageDescription(messageDescription: MessageDescription): boolean
This indicates whether or not the type of message can trigger the filter message action. This method is used in builder to filter the available actions.
Parameters
Parameter | Type |
---|---|
message | MessageDescription |
Returns
boolean
onExecute
onExecute(message: Message, actionConfig?: any): boolean | Promise<boolean>
The execution of the action when the message is matched.
Parameters
Parameter | Type |
---|---|
message | Message |
action | any |
Returns
boolean | Promise<boolean>
onRemoveListen
Class MethodonRemoveListen(messageType: MessageType, messageWidgetId?: string): void
When an action is removed from a message's listener, this function will be invoked.
Parameters
Parameter | Type |
---|---|
message | MessageType |
message | string |
Returns
void
id: string
The unique id of the action. For actions provided by a widget, the id is: widgetId + actionName.