Class: LiveQuery

LiveQuery

Represents a long-running query against Flex data wherein the returned result set subsequently receives pushed updates whenever new (or updated) records would match the given expression. Updated results are presented row-by-row until this query is explicitly closed. Use the Client#liveQuery method to create a live query.

Properties:
Name Type Description
sid String The immutable identifier of this query object, assigned by the system.
Fires:

Methods


close()

Closes this query instance and unsubscribes from further service events. This will eventually stop the physical inflow of updates over the network, when all other instances of this query are closed as well.

getItems()

Returns:
A snapshot of items matching the current query expression.
Type
LiveQuery#ItemsSnapshot

Type Definitions


ItemsSnapshot

A result set, i.e. a collection of items that matched a LiveQuery or InstantQuery expression. Each result is a key-value pair, where each key identifies its object uniquely. These results are equivalent to a set of InsightsItem-s.
Type:
  • Object.<string, Object>

Events


itemRemoved

Fired when an existing item has been removed.
Parameters:
Name Type Description
args Object Arguments provided with the event.
Properties
Name Type Description
key String The key of the removed item.
Example
liveQuery.on('itemRemoved', function(args) {
  console.log('Item ' + args.key + ' was removed');
});

itemUpdated

Fired when an item has been added or updated.
Parameters:
Name Type Description
item InsightsItem Updated item.
Example
liveQuery.on('itemUpdated', function(item) {
  console.log('Item ' + item.key + ' was updated');
  console.log('Item value: ', item.value);
});