Skip to content

Commit

Permalink
feat(facade): export syncExecuteCommand (#4102)
Browse files Browse the repository at this point in the history
  • Loading branch information
hexf00 authored Nov 19, 2024
1 parent e695309 commit d882624
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions packages/core/src/facade/f-univer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,11 @@ export class FUniver extends FBase {
}

/**
* Execute command
*
* @param {string} id Command ID
* @param {object} params Command parameters
* @param {IExecutionOptions} options Command execution options
* @returns {Promise<R>} Command execution result
* Execute a command with the given id and parameters.
* @param id Identifier of the command.
* @param params Parameters of this execution.
* @param options Options of this execution.
* @returns The result of the execution. It is a boolean value by default which indicates the command is executed.
*/
executeCommand<P extends object = object, R = boolean>(
id: string,
Expand All @@ -126,6 +125,21 @@ export class FUniver extends FBase {
return this._commandService.executeCommand(id, params, options);
}

/**
* Execute a command with the given id and parameters synchronously.
* @param id Identifier of the command.
* @param params Parameters of this execution.
* @param options Options of this execution.
* @returns The result of the execution. It is a boolean value by default which indicates the command is executed.
*/
syncExecuteCommand<P extends object = object, R = boolean>(
id: string,
params?: P,
options?: IExecutionOptions
): R {
return this._commandService.syncExecuteCommand(id, params, options);
}

/**
* Get hooks.
*
Expand Down

0 comments on commit d882624

Please sign in to comment.