g14o
Packages@g14o/events

Listeners

on, once, wildcards, and priorities.

const off = event.on("user.created", async (ctx) => {
  console.log(ctx.payload);
});

event.once("user.deleted", (ctx) => {
  console.log(ctx.payload.id);
});

event.on("user.*", (ctx) => {
  // wildcard
});

Use priority and AbortSignal via the third options argument. Prefer the unsubscribe function returned by on / once.