phaser - v4.0.0-rc.4
    Preparing search index...

    Class Map<K, V>

    The keys of a Map can be arbitrary values.

    var map = new Map([
    [ 1, 'one' ],
    [ 2, 'two' ],
    [ 3, 'three' ]
    ]);

    Type Parameters

    • K
    • V
    Index

    Constructors

    Properties

    entries: { [key: string]: V }

    The entries in this Map.

    size: number

    The number of key / value pairs in this Map.

    Methods

    • Returns true if the value exists within this Map. Otherwise, returns false.

      Parameters

      • value: V

        The value to search for.

      Returns boolean

    • Dumps the contents of this Map to the console via console.group.

      Returns void

    • Returns the value associated to the key, or undefined if there is none.

      Parameters

      • key: K

        The key of the element to return from the Map object.

      Returns V

    • Returns a boolean indicating whether an element with the specified key exists or not.

      Parameters

      • key: K

        The key of the element to test for presence of in this Map.

      Returns boolean

    • Merges all new keys from the given Map into this one. If it encounters a key that already exists it will be skipped unless override is set to true.

      Parameters

      • map: Structs.Map<K, V>

        The Map to merge in to this Map.

      • Optionaloverride: boolean

        Set to true to replace values in this Map with those from the source map, or false to skip them. Default false.

      Returns Structs.Map<K, V>

    • Adds an element with a specified key and value to this Map.

      If the key already exists, the value will be replaced.

      If you wish to add multiple elements in a single call, use the setAll method instead.

      Parameters

      • key: K

        The key of the element to be added to this Map.

      • value: V

        The value of the element to be added to this Map.

      Returns Structs.Map<K, V>

    • Adds all the elements in the given array to this Map.

      If the element already exists, the value will be skipped.

      Type Parameters

      • K
      • V

      Parameters

      • elements: V[]

        An array of key-value pairs to populate this Map with.

      Returns this