Skip to main content
This release is 4 versions behind 3.0.5 — the latest version of @collidor/command. Jump to latest

Built and signed on GitHub Actions

This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
This package works with Browsers
JSR Score
70%
Published
2 weeks ago (2.1.5)
class CommandBus

Constructors

new
CommandBus(
inject: Injector["inject"],
options?: { context?: TContext; },
)

Type Parameters

TContext extends CommandBusContext = CommandBusContext

Properties

Methods

bind<
C extends Command,
Q extends CommandHandler<TContext, C>,
>
(
command: Type<C>,
handler: Q,
): void
execute<C extends Command>(
command: C,
isVoid?: boolean,
): C[COMMAND_RETURN]
handler<
C extends Command,
This extends CommandInstance<TContext, C>,
Args extends unknown[],
HandlerArgs extends unknown[],
Target extends new (...args: HandlerArgs) => This,
>
(command: new (...args: Args) => C): (
target: Target,
context?: ClassDecoratorContext<new (...args: HandlerArgs) => This>,
) => void

Add Package

deno add jsr:@collidor/command

Import symbol

import { CommandBus } from "@collidor/command";

---- OR ----

Import directly with a jsr specifier

import { CommandBus } from "jsr:@collidor/command";

Add Package

npx jsr add @collidor/command

Import symbol

import { CommandBus } from "@collidor/command";

Add Package

yarn dlx jsr add @collidor/command

Import symbol

import { CommandBus } from "@collidor/command";

Add Package

pnpm dlx jsr add @collidor/command

Import symbol

import { CommandBus } from "@collidor/command";

Add Package

bunx jsr add @collidor/command

Import symbol

import { CommandBus } from "@collidor/command";