Skip to content

Function: emitEvent()

Makaio Framework


Makaio Framework / tools-core / 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.

S extends object

ToolExecutionContext

Tool execution context

S

Typed subject definition from a registered namespace

S["$meta"]["payload"]

Event payload matching the subject’s schema

Promise<void>

import { TaskSubjects } from '@makaio/tools-tasks/register';
await emitEvent(context, TaskSubjects.created, {
taskId: '123',
title: 'Fix bug',
});