waytale - v0.5.1
    Preparing search index...

    Class WaytaleGadgetController

    Manage gadgets. Load gadget-specific sources (gadget classes) on demand. Create gadgets. Trigger gadget API callbacks like onEnter()/onExit().

    Loading gadget classes from their respective source files is triggered when the space has loaded. Gadget creation is triggered when the map has loaded. To avoid a racing condition, loaded gadget classes are wrapped in promises.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    gadgetTypeLoaders: { [k: string]: Promise<GadgetType> } = {}

    A map of promises created for each gadget type (gadget type nmae) that resolves to the default export of gadget's source file.

    NAMESPACE_UUID: Uint8Array<ArrayBuffer> = ...
    webrtcConfig: { iceServers: object; signaling: string[] }

    Methods

    • Gadgets are typically defined outside this code base. To avoid tedious imports and broken dependencies, yet allow base functionality for gadgets, a peculiar initialisation sequence for gadgets is used (lower forms of black magic).

      There is no inheritence and the constructor of the specific gadget class is never called. Instead, each gadget is constructed as generic WaytaleGadget and initialised by means of an optional init() method the specific gadget class may define.

      Within the specific gadget, lookup of instance variables and methods on the level of the generic gadget is supported by making the specific gadget class the first prototype to look up in the prototype chain of the gadget instance.

      Parameters

      Returns Promise<WaytaleGadget | undefined>

    • When our avatar is set up, load stored gadgets.

      Gadgets reference their owner. To verify whether a specific gadget is owned by us, the avatar object needs to be ready. May change in the future.

      Parameters

      Returns Promise<void>

    • After a map is loaded, create all gadgets.

      Parameters

      Returns Promise<void>

    • On space load, get all enabled gadgets and load classes for each gadget.

      Parameters

      Returns void

    • When an avatar changes position, check whether the interactive area of a gadget has been entered or exited and call respective functions of the gadget, if available.

      Parameters

      Returns void

    • Parameters

      Returns void

    • Remove gadget from map. Updates list of gadgets and persists owned gadgets to database.

      Parameters

      Returns Promise<void>