Skip to content

MessageAction

Interface

The interface for all message actions. Message action executes when a matched message is received.

Properties

PropertyTypeNotes
destroy() => void

When a widget is removed, actions provided by this widget will be destroyed.

filterMessage(messageMessage) => 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(messageDescriptionMessageDescription) => 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.

getDefaultMessageActionConfig(messageMessage) => any

Get the default message action config. This method is called when a new message action is configured in the builder.

getSettingComponentUri(messageTypeMessageType, messageWidgetId?string) => string

This returns the action setting component uri. The returned value should match the settingUri from the widget manifest. If no setting is required, null is returned.

idstring

The unique id of the action. For actions provided by a widget, the id is: widgetId + actionName.

labelstring

The action label. To support i18n, use _action_${actionName} as the string key.

namestring

The action name.

onExecute(messageMessage, actionConfig?any) => boolean | Promise<boolean>

The execution of the action when the message is matched.

onRemoveListen(messageTypeMessageType, messageWidgetId?string) => void

When an action is removed from a message's listener, this function will be invoked.

sectionIdstring

The section ID that provides the action. If a widget id or section id is not provided, the action is provided by the Jimu framework.

widgetIdstring

The widget ID that provides the action. If a widget id or section id is not provided, the action is provided by the Jimu framework.

destroy

Interface Property
destroy: () => void

When a widget is removed, actions provided by this widget will be destroyed.

Type declaration
    function(): void
    Returns 
    void

filterMessage

Interface Property
filterMessage: (messageMessage) => boolean

This indicates whether a specific message can trigger the filter message action. This method is used to filter messages in the message manager.

Type declaration
    function(messageMessage): boolean
    Parameters
    ParameterType
    messageMessage
    Returns 
    boolean

filterMessageDescription

Interface Property
filterMessageDescription: (messageDescriptionMessageDescription) => 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.

Type declaration

getDefaultMessageActionConfig

optional
Interface Property
getDefaultMessageActionConfig: (messageMessage) => any

Get the default message action config. This method is called when a new message action is configured in the builder.

Type declaration
    function(messageMessage): any
    Parameters
    ParameterType
    messageMessage
    Returns 
    any

getSettingComponentUri

optional
Interface Property
getSettingComponentUri: (messageTypeMessageType, messageWidgetId?string) => string

This returns the action setting component uri. The returned value should match the settingUri from the widget manifest. If no setting is required, null is returned.

This method is required for framework actions but optional for widget actions.

This setting component is used to configure the action according to the message.

Type declaration
    function(messageTypeMessageType, messageWidgetId?string): string
    Parameters
    ParameterType
    messageTypeMessageType
    messageWidgetIdstring
    Returns 
    string

id

Interface Property
id: string

The unique id of the action. For actions provided by a widget, the id is: widgetId + actionName.

label

Interface Property
label: string

The action label. To support i18n, use _action_${actionName} as the string key.

name

optional
Interface Property
name: string

The action name.

onExecute

Interface Property
onExecute: (messageMessage, actionConfig?any) => boolean | Promise<boolean>

The execution of the action when the message is matched.

Please make sure this method returns true to indicate the action is executed successfully, so the following actions can be executed.

Type declaration
    function(messageMessage, actionConfig?any): boolean | Promise<boolean>
    Parameters
    ParameterType
    messageMessage
    actionConfigany
    Returns 
    boolean | Promise<boolean>

onRemoveListen

Interface Property
onRemoveListen: (messageTypeMessageType, messageWidgetId?string) => void

When an action is removed from a message's listener, this function will be invoked.

Type declaration
    function(messageTypeMessageType, messageWidgetId?string): void
    Parameters
    ParameterType
    messageTypeMessageType
    messageWidgetIdstring
    Returns 
    void

sectionId

optional
Interface Property
sectionId: string

The section ID that provides the action. If a widget id or section id is not provided, the action is provided by the Jimu framework.

widgetId

optional
Interface Property
widgetId: string

The widget ID that provides the action. If a widget id or section id is not provided, the action is provided by the Jimu framework.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.