Function: emitEvent()
Makaio Framework / tools-core / emitEvent
Function: emitEvent()
Section titled “Function: emitEvent()”emitEvent<
S>(context,subject,payload):Promise<void>
Defined in: ../../../tools/core/src/tool-utils.ts:43
Emits an event on the bus if available.
The subject must be a properly typed subject definition from a registered namespace. Type inference ensures the payload matches the subject’s schema at compile time.
Type Parameters
Section titled “Type Parameters”S extends object
Parameters
Section titled “Parameters”context
Section titled “context”Tool execution context
subject
Section titled “subject”S
Typed subject definition from a registered namespace
payload
Section titled “payload”S["$meta"]["payload"]
Event payload matching the subject’s schema
Returns
Section titled “Returns”Promise<void>
Example
Section titled “Example”import { TaskSubjects } from '@makaio/tools-tasks/register';
await emitEvent(context, TaskSubjects.created, { taskId: '123', title: 'Fix bug',});