phaser - v3.90.0
    Preparing search index...

    Class ProcessQueue<T>

    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.

    Type Parameters

    • T

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    checkQueue: boolean

    If true only unique objects will be allowed in the queue.

    length: number

    The number of entries in the active list.

    Methods

    • Adds a new item to the Process Queue.

      The item is added to the pending list and made active in the next update.

      Parameters

      • item: T

        The item to add to the queue.

      Returns ProcessQueue<T>

    • Add a listener for a given event.

      Parameters

      • event: string | symbol

        The event name.

      • fn: Function

        The listener function.

      • Optionalcontext: any

        The context to invoke the listener with. Default this.

      Returns this

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

      Returns void

    • Calls each of the listeners registered for a given event.

      Parameters

      • event: string | symbol

        The event name.

      • ...args: any[]

        Additional arguments that will be passed to the event handler.

      Returns boolean

    • Return an array listing the events for which the emitter has registered listeners.

      Returns (string | symbol)[]

    • Returns the current list of active items.

      This method returns a reference to the active list array, not a copy of it. Therefore, be careful to not modify this array outside of the ProcessQueue.

      Returns T[]

    • Checks the given item to see if it is already active within this Process Queue.

      Parameters

      • item: T

        The item to check.

      Returns ProcessQueue<T>

    • Checks the given item to see if it is already pending destruction from this Process Queue.

      Parameters

      • item: T

        The item to check.

      Returns ProcessQueue<T>

    • Checks the given item to see if it is already pending addition to this Process Queue.

      Parameters

      • item: T

        The item to check.

      Returns ProcessQueue<T>

    • Return the number of listeners listening to a given event.

      Parameters

      • event: string | symbol

        The event name.

      Returns number

    • Return the listeners registered for a given event.

      Parameters

      • event: string | symbol

        The event name.

      Returns Function[]

    • Remove the listeners of a given event.

      Parameters

      • event: string | symbol

        The event name.

      • Optionalfn: Function

        Only remove the listeners that match this function.

      • Optionalcontext: any

        Only remove the listeners that have this context.

      • Optionalonce: boolean

        Only remove one-time listeners.

      Returns this

    • Add a listener for a given event.

      Parameters

      • event: string | symbol

        The event name.

      • fn: Function

        The listener function.

      • Optionalcontext: any

        The context to invoke the listener with. Default this.

      Returns this

    • Add a one-time listener for a given event.

      Parameters

      • event: string | symbol

        The event name.

      • fn: Function

        The listener function.

      • Optionalcontext: any

        The context to invoke the listener with. Default this.

      Returns this

    • Removes an item from the Process Queue.

      The item is added to the 'destroy' list and is fully removed in the next update.

      Parameters

      • item: T

        The item to be removed from the queue.

      Returns ProcessQueue<T>

    • Removes all active items from this Process Queue.

      All the items are marked as 'pending destroy' and fully removed in the next update.

      Returns this

    • Remove all listeners, or those of the specified event.

      Parameters

      • Optionalevent: string | symbol

        The event name.

      Returns this

    • Remove the listeners of a given event.

      Parameters

      • event: string | symbol

        The event name.

      • Optionalfn: Function

        Only remove the listeners that match this function.

      • Optionalcontext: any

        Only remove the listeners that have this context.

      • Optionalonce: boolean

        Only remove one-time listeners.

      Returns this

    • Removes all listeners.

      Returns void

    • 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.

      Returns T[]