Skip to content

Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.

feat(facade): export syncExecuteCommand (#4102)

#FF0000d88262466c3f
diff --git a/packages/core/src/facade/f-univer.ts b/packages/core/src/facade/f-univer.ts
index 662c38c6a5..22810cc03a 100644
--- a/packages/core/src/facade/f-univer.ts
+++ b/packages/core/src/facade/f-univer.ts
@@ -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,
@@ -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.
*