API Reference
@univerjs
@univerjs/core
classes
Commandservice

@univerjs/core v0.1.17Docs


Class: CommandService

Implements

Constructors

new CommandService()

new CommandService(_injector, _logService): CommandService

Parameters

ParameterType
_injectorInjector
_logServiceILogService

Returns

CommandService

Defined in

submodules/univer/packages/core/src/services/command/command.service.ts:228 (opens in a new tab)

Properties

PropertyModifierTypeDefined in
_commandRegistryreadonlyCommandRegistrysubmodules/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

ParameterType
listenerCommandListener

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 ParameterDefault type
P extends objectobject
Rboolean

Parameters

ParameterType
idstring
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

ParameterTypeDescription
commandIdstringThe id of the command.

Returns

boolean

Implementation of

ICommandService.hasCommand

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

ParameterType
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

ParameterType
commandICommand<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

ParameterType
commandICommand<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 ParameterDefault type
P extends objectobject
Rboolean

Parameters

ParameterType
idstring
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)


Copyright © 2021-2024 DreamNum Co,Ltd. All Rights Reserved.