@univerjs/core v0.1.17 • Docs
Class: CommandService
Implements
Constructors
new CommandService()
new CommandService(_injector, _logService): CommandService
Parameters
Parameter | Type |
---|---|
_injector | Injector |
_logService | ILogService |
Returns
Defined in
submodules/univer/packages/core/src/services/command/command.service.ts:228 (opens in a new tab)
Properties
Property | Modifier | Type | Defined in |
---|---|---|---|
_commandRegistry | readonly | CommandRegistry | submodules/univer/packages/core/src/services/command/command.service.ts:217 (opens in a new tab) |
Methods
beforeCommandExecuted()
beforeCommandExecuted(listener): IDisposable
Register a callback function that will be executed before a command is executed.
Parameters
Parameter | Type |
---|---|
listener | CommandListener |
Returns
IDisposable
Implementation of
ICommandService
.beforeCommandExecuted
Defined in
submodules/univer/packages/core/src/services/command/command.service.ts:248 (opens in a new tab)
executeCommand()
executeCommand<P, R>(
id,
params?,
options?): Promise<R>
Type Parameters
Type Parameter | Default type |
---|---|
P extends object | object |
R | boolean |
Parameters
Parameter | Type |
---|---|
id | string |
params ? | P |
options ? | IExecutionOptions |
Returns
Promise
<R
>
Implementation of
ICommandService
.executeCommand
Defined in
submodules/univer/packages/core/src/services/command/command.service.ts:274 (opens in a new tab)
hasCommand()
hasCommand(commandId): boolean
Check if a command is already registered at the current command service.
Parameters
Parameter | Type | Description |
---|---|---|
commandId | string | The id of the command. |
Returns
boolean
Implementation of
Defined in
submodules/univer/packages/core/src/services/command/command.service.ts:236 (opens in a new tab)
onCommandExecuted()
onCommandExecuted(listener): IDisposable
Register a callback function that will be executed after a command is executed.
Parameters
Parameter | Type |
---|---|
listener | (commandInfo ) => void |
Returns
IDisposable
Implementation of
ICommandService
.onCommandExecuted
Defined in
submodules/univer/packages/core/src/services/command/command.service.ts:261 (opens in a new tab)
registerCommand()
registerCommand(command): IDisposable
Parameters
Parameter | Type |
---|---|
command | ICommand <object , boolean > |
Returns
IDisposable
Implementation of
ICommandService
.registerCommand
Defined in
submodules/univer/packages/core/src/services/command/command.service.ts:240 (opens in a new tab)
registerMultipleCommand()
registerMultipleCommand(command): IDisposable
Parameters
Parameter | Type |
---|---|
command | ICommand <object , boolean > |
Returns
IDisposable
Implementation of
ICommandService
.registerMultipleCommand
Defined in
submodules/univer/packages/core/src/services/command/command.service.ts:244 (opens in a new tab)
syncExecuteCommand()
syncExecuteCommand<P, R>(
id,
params?,
options?): R
Type Parameters
Type Parameter | Default type |
---|---|
P extends object | object |
R | boolean |
Parameters
Parameter | Type |
---|---|
id | string |
params ? | P |
options ? | IExecutionOptions |
Returns
R
Implementation of
ICommandService
.syncExecuteCommand
Defined in
submodules/univer/packages/core/src/services/command/command.service.ts:302 (opens in a new tab)