Class: InstantQuery

InstantQuery

Allows repetitive quick searches against a specific Flex data. Unlike a LiveQuery, this result set does not subscribe to any updates and therefore receives no events beyond the initial result set. Use the Client#instantQuery method to create an Instant Query.

new InstantQuery()

Fires:

Methods


getItems()

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

Spawns a new search request. The result will be provided asynchronously via the InstantQuery#event:searchResult event.
Parameters:
Name Type Description
queryString String The expression to be executed against the target data.
Returns:
a promise that resolves when query result has been received.
Type
Promise.<void>

<async> subscribe()

Instantiates a LiveQuery object based on the last known query expression that was passed to the InstantQuery#search method. This LiveQuery will start receiving updates with new results, while current object can be still used to execute repetitive searches.
Returns:
a promise which resolves when the LiveQuery object is ready.
Type
Promise.<LiveQuery>

Events


searchResult

Fired when a search result is ready.
Parameters:
Name Type Description
items LiveQuery#ItemsSnapshot A snapshot of items matching current query expression.
Example
instantQuery.on('searchResult', function(items) {
   Object.entries(items).forEach(([key, value]) => {
     console.log('Search result item key: ' + key);
     console.log('Search result item value: ' + value);
   });
});