Browse Source

Update runCommand/stopCommand in TS

pull/4504/head
Artur Arseniev 4 years ago
parent
commit
23c2a7acb2
  1. 4
      index.d.ts
  2. 4
      src/editor/index.ts

4
index.d.ts

@ -921,7 +921,7 @@ declare namespace grapesjs {
* @param options - Custom options * @param options - Custom options
* @returns The return is defined by the command * @returns The return is defined by the command
*/ */
runCommand(id: string, options: any): any; runCommand(id: string, options?: Record<string, unknown>): any;
/** /**
* Stop the command if stop method was provided * Stop the command if stop method was provided
* @example * @example
@ -930,7 +930,7 @@ declare namespace grapesjs {
* @param options - Custom options * @param options - Custom options
* @returns The return is defined by the command * @returns The return is defined by the command
*/ */
stopCommand(id: string, options: any): any; stopCommand(id: string, options?: Record<string, unknown>): any;
/** /**
* Store data to the current storage * Store data to the current storage
* @param options - Storage options * @param options - Storage options

4
src/editor/index.ts

@ -493,7 +493,7 @@ export default class EditorModule implements IBaseModule<typeof defaults> {
* @example * @example
* editor.runCommand('myCommand', {someValue: 1}); * editor.runCommand('myCommand', {someValue: 1});
*/ */
runCommand(id: string, options = {}) { runCommand(id: string, options: Record<string, unknown> = {}) {
return this.em.get('Commands').run(id, options); return this.em.get('Commands').run(id, options);
} }
@ -505,7 +505,7 @@ export default class EditorModule implements IBaseModule<typeof defaults> {
* @example * @example
* editor.stopCommand('myCommand', {someValue: 1}); * editor.stopCommand('myCommand', {someValue: 1});
*/ */
stopCommand(id: string, options = {}) { stopCommand(id: string, options: Record<string, unknown> = {}) {
return this.em.get('Commands').stop(id, options); return this.em.get('Commands').stop(id, options);
} }

Loading…
Cancel
Save