new Set([elements])
name | type | arguments | description |
---|---|---|---|
elements | Array.<*> | <optional> |
An optional array of elements to insert into this Set. |
The entries of this Set. Stored internally as an array.
The size of this Set. This is the number of entries within it. Changing the size will truncate the Set if the given value is smaller than the current size. Increasing the size larger than the current size has no effect.
Clears this Set so that it no longer contains any values.
This Set object.
Returns true
if this Set contains the given value, otherwise returns false
.
name | type | description |
---|---|---|
value | * |
The value to check for in this Set. |
true
if the given value was found in this Set, otherwise false
.
Removes the given value from this Set if this Set contains that value.
name | type | description |
---|---|---|
value | * |
The value to remove from the Set. |
This Set object.
Returns a new Set containing all the values in this Set which are not also in the given Set.
name | type | description |
---|---|---|
set | Phaser.Structs.Set |
The Set to perform the difference with. |
A new Set containing all the values in this Set that are not also in the Set provided as an argument to this method.
Dumps the contents of this Set to the console via console.group
.
Passes each value in this Set to the given callback.
Use this function when you know this Set will be modified during the iteration, otherwise use iterate
.
name | type | arguments | description |
---|---|---|---|
callback | EachSetCallback |
The callback to be invoked and passed each value this Set contains. |
|
callbackScope | * | <optional> |
The scope of the callback. |
This Set object.
Get an element of this Set which has a property of the specified name, if that property is equal to the specified value.
If no elements of this Set satisfy the condition then this method will return null
.
name | type | description |
---|---|---|
property | string |
The property name to check on the elements of this Set. |
value | * |
The value to check for. |
The first element of this Set that meets the required condition, or null
if this Set contains no elements that meet the condition.
Returns an array containing all the values in this Set.
An array containing all the values in this Set.
Returns a new Set that contains only the values which are in this Set and that are also in the given Set.
name | type | description |
---|---|---|
set | Phaser.Structs.Set |
The Set to intersect this set with. |
The result of the intersection, as a new Set.
Passes each value in this Set to the given callback.
For when you absolutely know this Set won't be modified during the iteration.
The callback must return a boolean. If it returns false
then it will abort
the Set iteration immediately. If it returns true
, it will carry on
iterating the next child in the Set.
name | type | arguments | description |
---|---|---|---|
callback | EachSetCallback |
The callback to be invoked and passed each value this Set contains. |
|
callbackScope | * | <optional> |
The scope of the callback. |
This Set object.
Goes through each entry in this Set and invokes the given function on them, passing in the arguments.
name | type | arguments | description |
---|---|---|---|
callbackKey | string |
The key of the function to be invoked on each Set entry. |
|
args | * | <optional> |
Additional arguments that will be passed to the callback, after the child. |
This Set object.
Inserts the provided value into this Set. If the value is already contained in this Set this method will have no effect.
name | type | description |
---|---|---|
value | * |
The value to insert into this Set. |
This Set object.
Returns a new Set containing all values that are either in this Set or in the Set provided as an argument.
name | type | description |
---|---|---|
set | Phaser.Structs.Set |
The Set to perform the union with. |
A new Set containing all the values in this Set and the Set provided as an argument.