CommandToken
A command that a plugin can call like a function, such as ctx.rows.modify and ctx.outlines.modify. Calling it with its arguments runs the command and returns the result. Its intent function builds the request for the change without running it, which is what a hook returns as a follow-up.
Example
Section titled “Example”const outcome = await ctx.rows.modify({ id: row.id, title: 'Buy milk' }); // runs the commandconst request = ctx.rows.modify.intent({ id: row.id, title: 'Buy milk' }); // builds the request onlyType Parameters
Section titled “Type Parameters”| Type Parameter | Description |
|---|---|
A |
the type of the arguments of the command |
R |
the type of the result of the command |
CommandToken(args): Promise<R>;Runs the command.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
args |
A |
the arguments of the command |
Returns
Section titled “Returns”Promise<R>
the result of the command
Methods
Section titled “Methods”intent()
Section titled “intent()”intent(args): Intent;Builds the request for the change without running it.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
args |
A |
the arguments of the command |
Returns
Section titled “Returns”the request, to return from a hook as a follow-up or to pass to ctx.dispatch
