Service to allow components to communicate with eachother through events

Constructors

Methods

  • Listen for a game event and execute a function when it occurs

    Type Parameters

    • T

      Type used for the event data

    Parameters

    • gameEvent: SwitchPage

      Kind of game event to listen for

    • callback: (event: T) => void

      Function to call when the game event occurs. Will get the event data as an argument.

    Returns void

  • Dispatch a game event

    Type Parameters

    • T

      Type used for the event data

    Parameters

    • gameEvent: SwitchPage

      Kind of game event to dispatch

    • Optionaldata: T

      Event data to send along with the dispatch

    Returns void

  • Dispatch a Switch Page event

    Parameters

    • page: Canvas

      Page to switch to

    Returns void