# LiveQuery

## AV. LiveQuery

A LiveQuery, created by AV.Query#subscribe is an EventEmitter notifies changes of the Query.

## Constructor

#### new LiveQuery()

Source:
  - live-query.js, line 30
Since:
  - 3.0.0

### Methods

#### (static) pause()

Source:
  - live-query.js, line 160

Pause the LiveQuery connection. This is useful to deactivate the SDK when the app is swtiched to background.

##### Returns:

void

#### (static) resume()

Source:
  - live-query.js, line 169

Resume the LiveQuery connection. All subscriptions will be restored after reconnection.

##### Returns:

void

#### unsubscribe() → {Promise}

Source:
  - live-query.js, line 100

unsubscribe the query

##### Returns:

Type
  Promise

### Events

#### create

Source:
  - live-query.js, line 81

A new AV.Object which fulfills the Query you subscribe is created.

##### Parameters:

Name | Type | Description
--- | --- | ---
`target` | AV.Object | AV.File | updated object

#### delete

Source:
  - live-query.js, line 86

An existing AV.Object which fulfills the Query you subscribe is deleted.

##### Parameters:

Name | Type | Description
--- | --- | ---
`target` | AV.Object | AV.File | updated object

#### enter

Source:
  - live-query.js, line 67

An existing AV.Object which doesn't fulfill the Query is updated and now it fulfills the Query.

##### Parameters:

Name | Type | Description
--- | --- | ---
`target` | AV.Object | AV.File | updated object
`updatedKeys` | Array.<String> | updated keys

#### leave

Source:
  - live-query.js, line 73

An existing AV.Object which fulfills the Query is updated and now it doesn't fulfill the Query.

##### Parameters:

Name | Type | Description
--- | --- | ---
`target` | AV.Object | AV.File | updated object
`updatedKeys` | Array.<String> | updated keys

#### update

Source:
  - live-query.js, line 61

An existing AV.Object which fulfills the Query you subscribe is updated.

##### Parameters:

Name | Type | Description
--- | --- | ---
`target` | AV.Object | AV.File | updated object
`updatedKeys` | Array.<String> | updated keys