• Simply takes a payload and passes it to all the listeners.

    While dispatching:

    • This is an unsafe method if by chance any of the listeners modify the array.
    • It cannot prevent changes to the payload.

    Improving safety:

    • Only use a local array that isn't exposed to the listeners.
    • Use the dispatch method instead as it makes a arrayCopy of the listeners array.
    • Freeze the listeners array so it can't be modified.
    • Freeze the payload.

    Specifying trap will catch any errors and pass them along if trap is a function. A payload is used instead of arguments for easy typing.

    Type Parameters

    • T

    Parameters

    Returns void

Generated using TypeDoc