waytale - v0.5.1
    Preparing search index...

    Class WaytaleAvatar

    Representation of another person in the same space.

    Hierarchy (View Summary)

    Index

    Constructors

    • New avatar. Peer ID might be undefined as long as space is used offline, i.e. no peer-to-peer connection has been established yet.

      Parameters

      • id: number
      • name: string
      • pronouns: string
      • graphics: string
      • position: Position

      Returns WaytaleAvatar

    Properties

    graphics: string
    id: number
    name: string
    position: Position

    tile coordinates

    pronouns: string

    Methods

    • Unsubscribe from an event by name with a specific handler.

      Parameters

      • eventName: any

        event to unsubscribe from

      • handler: any

        callback handling the event

      Returns void

    • Subscribe to an event by name with a specific handler.

      Parameters

      • eventName: any

        event to subscribe to

      • handler: any

        callback handling the event

      Returns void

    • Subscribe to an event, but run the handler only once. After running exactly once the handler will be immediately unsubscribed.

      Parameters

      • eventName: any

        event to subscribe to

      • handler: any

        callback handling the event

      Returns void

    • Trigger the calls of the event handlers subscribed to the given event.

      Parameters

      • eventName: any

        event to trigger

      • ...args: any[]

        arguments to forward to the event handlers

      Returns void

    • Change the value of a property and trigger an event of the same name. A second event is triggered where the event name is the name of the property suffixed by the name of the operation.

      The event handlers will be called with the parameters of (in this order) the new value, the old value, and a reference to this.

      The method parameter specifies how the value is updated depending on whether the property is a normal value, an array, or an object. The respective value in parentheses is used as the suffix for the second trigger call.

      • assign for normal assignment (Assign)
      • prepend, append, and remove for arrays (Add, Add, Remove)
      • insert, replace, and delete for objects and maps (Insert, Replace, Delete)

      For operations on objects, the extra parameter is used as "key" i.e. property name.

      Parameters

      • key: any

        the name of the property

      • value: any

        the new value

      • method: string = 'assign'

        how to update, see description

      • extra: any = undefined

        key to use for object operations

      Returns void