Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "source/System/Collections/Array/Dispatch"

Index

Functions

dispatch

  • Simply takes a payload and passes it to all the listeners. Makes a copy of the listeners before calling dispatchUnsafe.

    Type parameters

    • T

    Parameters

    Returns void

mapped

  • Simply takes a payload and passes it to all the listeners. Returns the results in an array that matches the indexes of the listeners.

    Type parameters

    • T

    • TResult

    Parameters

    Returns TResult[]

unsafe

  • 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 copy 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