@cartridge-engine/event
    Preparing search index...

    Function useEmitter

    • Create a stable emitter function pre-bound to a specific event.

      The returned function is stable across re-renders (via useCallback) because the bus instance and event name are constant for the provider's lifetime.

      Type Parameters

      • K extends string

      Parameters

      • event: K

        The event name to emit.

      Returns (payload: any) => void

      A function that accepts a payload and emits the event.

      const emitSave = useEmitter('save');
      emitSave({ id: 1 });