Class: ProcessQueue

Phaser.Structs. ProcessQueue

A Process Queue maintains three internal lists.

The pending list is a selection of items which are due to be made 'active' in the next update. The active list is a selection of items which are considered active and should be updated. The destroy list is a selection of items that were active and are awaiting being destroyed in the next update.

When new items are added to a Process Queue they are put in the pending list, rather than being added immediately the active list. Equally, items that are removed are put into the destroy list, rather than being destroyed immediately. This allows the Process Queue to carefully process each item at a specific, fixed time, rather than at the time of the request from the API.


new ProcessQueue()

Since: 3.0.0
Source: src/structs/ProcessQueue.js (Line 9)

Methods


add(item)

Adds a new item to the Process Queue. The item is added to the pending list and made active in the next update.

Parameters:
Name Type Description
item *

The item to add to the queue.

Since: 3.0.0
Source: src/structs/ProcessQueue.js (Line 86)
Returns:

This Process Queue object.

Type
Phaser.Structs.ProcessQueue

destroy()

Immediately destroys this process queue, clearing all of its internal arrays and resetting the process totals.

Since: 3.0.0
Source: src/structs/ProcessQueue.js (Line 209)

getActive()

Returns the current list of active items.

Since: 3.0.0
Source: src/structs/ProcessQueue.js (Line 194)
Returns:

A list of active items.

Type
Array.<*>

remove(item)

Removes an item from the Process Queue. The item is added to the pending destroy and fully removed in the next update.

Parameters:
Name Type Description
item *

The item to be removed from the queue.

Since: 3.0.0
Source: src/structs/ProcessQueue.js (Line 109)
Returns:

This Process Queue object.

Type
Phaser.Structs.ProcessQueue

update()

Update this queue. First it will process any items awaiting destruction, and remove them.

Then it will check to see if there are any items pending insertion, and move them to an active state. Finally, it will return a list of active items for further processing.

Since: 3.0.0
Source: src/structs/ProcessQueue.js (Line 132)
Returns:

A list of active items.

Type
Array.<*>