Lime Web Components API Documentation - v6.24.0
    Preparing search index...

    Enumeration CommandEventName

    Events dispatched by the commandbus event middleware.

    The command bus dispatches events at key points in the command lifecycle, allowing you to observe command execution, access results, handle errors, or even prevent commands from executing.

    // Listen for command results
    document.addEventListener(CommandEventName.Handled, (event: CommandEvent) => {
    console.log('Command executed:', event.detail.command);
    console.log('Result:', event.detail.result);
    });

    // Handle command errors
    document.addEventListener(CommandEventName.Failed, (event: CommandEvent) => {
    console.error('Command failed:', event.detail.error);
    });

    // Prevent a command from executing
    document.addEventListener(CommandEventName.Received, (event: CommandEvent) => {
    if (shouldBlockCommand(event.detail.command)) {
    event.preventDefault();
    }
    });
    Index

    Enumeration Members

    Enumeration Members

    Failed: "command.failed"

    Dispatched if an error occurs while handling the command. The event detail includes the error that was thrown.

    Handled: "command.handled"

    Dispatched when the command has been handled by the commandbus. The event detail includes the result returned by the command handler.

    Received: "command.received"

    Dispatched when the command has been received by the commandbus. Calling preventDefault() on the event will stop the command from being handled