Function: provideOutput()
provideOutput<
Output
>(output
,cleanup
?):RegisterCleanup
<Output
>
Provide output from the register function of a Plan
Type Parameters
• Output
Parameters
• output: Output
• cleanup?
Returns
RegisterCleanup
<Output
>
A cleanup function
Examples
// This is entirely optional and would be inferred correctly, but
// it can be useful for documentation!
export interface RegisteredAtOutput {
registered_at: number;
}
export const RegisteredAtPlan = definePlan({
name: "RegisteredAt",
register(editor) {
return provideOutput<RegisteredAtOutput>({ registered_at: Date.now() });
},
});
export interface UniqueCommandOutput {
command: LexicalCommand<unknown>;
}
export const UniqueCommandPlan = definePlan({
name: 'UniqueCommand',
register(editor) {
const output: UniqueCommnadOutput = {command: createCommand('UNIQUE_COMMAND')};
const cleanup = registerCommand(
command,
(_payload) => {
console.log('Unique command received!');
return true;
}
COMMAND_PRIORITY_EDITOR
);
return provideOutput(output, cleanup);
},
});