JSDoc: Class: ContentEventObserverService

# Class: ContentEventObserverService

## ContentEventObserverService(windowGlobal, sendAsyncMessage)

Provides the frame script backend for the `WebElementEventTarget`.

This service receives requests for new DOM events to listen for and to cease listening for, and despatches IPC messages to the browser when they fire.

## Constructor

#### new ContentEventObserverService(windowGlobal, sendAsyncMessage)

##### Parameters:

Name | Type | Description
--- | --- | ---
`windowGlobal` | WindowProxy | Window.
`sendAsyncMessage` | nsIMessageSender.sendAsyncMessage | Function for sending an async message to the parent browser.

Source:
  - dom.js, line 138

### Methods

#### add(type)

Observe a new DOM event.

When the DOM event of type fires, a message is passed to the parent browser's event observer.

If event type is already being observed, only a single message is sent. E.g. multiple registration for events will only ever emit a maximum of one message.

##### Parameters:

Name | Type | Description
--- | --- | ---
`type` | string | DOM event to listen for.

Source:
  - dom.js, line 164

#### clear()

Ceases observing all previously registered DOM events.

Source:
  - dom.js, line 187

#### remove(type)

Ceases observing a DOM event.

##### Parameters:

Name | Type | Description
--- | --- | ---
`type` | string | DOM event to stop listening for.

Source:
  - dom.js, line 178