# Class EventQueue

A structure responsible for collecting events generated by the physics engine.

To avoid leaking WASM resources, this MUST be freed manually with `eventQueue.free()` once you are done using it.

- Defined in pipeline/event_queue.d.ts:64

#####
Index

### Constructors

constructor

### Properties

raw

### Methods

clear
drainCollisionEvents
drainContactForceEvents
free

## Constructors

### constructor

- new EventQueue(autoDrain, raw?): EventQueue

- Creates a new event collector.

  #### Parameters

  - autoDrain: boolean

    setting this to `true` is strongly recommended. If true, the collector will be automatically drained before each `world.step(collector)`. If false, the collector will keep all events in memory unless it is manually drained/cleared; this may lead to unbounded use of RAM if no drain is performed.

  - `Optional` raw: RawEventQueue

  #### Returns EventQueue

  - Defined in pipeline/event_queue.d.ts:74

## Properties

### raw

raw: RawEventQueue

- Defined in pipeline/event_queue.d.ts:65

## Methods

### clear

- clear(): void

- Removes all events contained by this collector

  #### Returns void

  - Defined in pipeline/event_queue.d.ts:100

### drainCollisionEvents

- drainCollisionEvents(f): void

- Applies the given javascript closure on each collision event of this collector, then clear the internal collision event buffer.

  #### Parameters

  - f: ((handle1, handle2, started) => void)

    JavaScript closure applied to each collision event. The closure must take three arguments: two integers representing the handles of the colliders involved in the collision, and a boolean indicating if the collision started (true) or stopped (false).

    - - (handle1, handle2, started): void

      - #### Parameters

        - handle1: number
        - handle2: number
        - started: boolean

        #### Returns void

  - Defined in pipeline/event_queue.d.ts:88

### drainContactForceEvents

- drainContactForceEvents(f): void

- Applies the given javascript closure on each contact force event of this collector, then clear the internal collision event buffer.

  #### Parameters

  - f: ((event) => void)

    JavaScript closure applied to each collision event. The closure must take one `TempContactForceEvent` argument.

    - - (event): void

      - #### Parameters

        - event: TempContactForceEvent

        #### Returns void

  - Defined in pipeline/event_queue.d.ts:96

### free

- free(): void

- Release the WASM memory occupied by this event-queue.

  #### Returns void

  - Defined in pipeline/event_queue.d.ts:78