@univerjs/core v0.5.0-beta.1 • Docs
Interface: IMultiCommand<P, R>
A command that may have multiple implementations. Each implementation should have different priority
and preconditions
callback to determine which implementation should be executed.
Extends
ICommand
<P
,R
>
Type Parameters
Type Parameter | Default type |
---|---|
P extends object | object |
R | boolean |
Properties
Property | Modifier | Type | Description | Inherited from | Defined in |
---|---|---|---|---|---|
id | readonly | string | Identifier of the command. It should be unique in the application unless it is a IMultiCommand. Its pattern should be like <namespace>.<type>.<command-name> . Example { id: 'sheet.command.set-selection-frozen' } | ICommand .id | packages/api/tmp/univer-pro/submodules/univer/packages/core/src/services/command/command.service.ts:66 |
name | public | string | The name of the multi command. It should be unique in the application. | - | packages/api/tmp/univer-pro/submodules/univer/packages/core/src/services/command/command.service.ts:88 |
preconditions? | public | (contextService : IContextService ) => boolean | A callback function that tells ICommandService if this implementation should be executed. | - | packages/api/tmp/univer-pro/submodules/univer/packages/core/src/services/command/command.service.ts:98 |
priority | public | number | Priority of this implementation. Implementation with higher priority will be checked first. | - | packages/api/tmp/univer-pro/submodules/univer/packages/core/src/services/command/command.service.ts:92 |
type | readonly | CommandType | The type of the command. | ICommand .type | packages/api/tmp/univer-pro/submodules/univer/packages/core/src/services/command/command.service.ts:70 |
Methods
handler()
handler(
accessor,
params?,
options?): R | Promise<R>
The handler of the command.
Parameters
Parameter | Type | Description |
---|---|---|
accessor | IAccessor | The accessor to the dependency injection container. |
params ? | P | Params of the command. Params should be serializable. |
options ? | IExecutionOptions | Options of the command. |
Returns
R
| Promise
<R
>
The result of the command. By default it should be a boolean value which indicates the command is executed successfully or not.
Inherited from
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/services/command/command.service.ts:79