Skip to content

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.

const outcome = await ctx.rows.modify({ id: row.id, title: 'Buy milk' }); // runs the command
const request = ctx.rows.modify.intent({ id: row.id, title: 'Buy milk' }); // builds the request only
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.

Parameter Type Description
args A the arguments of the command

Promise<R>

the result of the command

intent(args): Intent;

Builds the request for the change without running it.

Parameter Type Description
args A the arguments of the command

Intent

the request, to return from a hook as a follow-up or to pass to ctx.dispatch