Home > @i2analyze/notebook-sdk > commands > ICommandConfig > onSurface
commands.ICommandConfig.onSurface() method
Runs when an action derived from the command is surfaced, enabling the command to configure the action in response to events.
Signature:
onSurface?(action: IAction, eventApi: CommandEventsMap[TCommandType], signal: AbortSignal): void | (() => void);
Introduced: version 1.0
Parameters
Parameter | Type | Description |
---|---|---|
action | IAction | The action being surfaced. |
eventApi | CommandEventsMap[TCommandType] | The events that the command can subscribe to. |
signal | AbortSignal | A signal that the application uses to tell the command that it is removing the action from the user interface. |
Returns:
void | (() => void)
A function that the application calls when it removes the action from the user interface. In its implementation, the command must unsubscribe from any events that it has subscribed to.
Remarks
If there is no implementation of onSurface()
, the action is always enabled.