File: /home/alex/dev/work/webapps/branches/scopes/doc/src/bindings/src/preview-query.js
/**
*
* Represents a particular preview
*
* @module ScopeJS
* @class PreviewQuery
*
* @example
var scopes = require('unity-js-scopes')
function on_preview(result, action_metadata) {
return new scopes.lib.preview_query(
result,
action_metadata,
// run
function(preview_reply) {},
// cancelled
function() {});
}
scopes.self.initialize(
{}
,
{
run: function() { },
start: function(scope_id) { },
preview: on_preview,
}
);
*
* @constructor
* @param canned_query CannedQuery
* @param action_metadata ActionMetadata
* @param run Function({PreviewReply}) Function callback that is to be called by the scope runtime to start the preview.
Your implementation of run() can use the provided PreviewReply object to
push results for the preview and call finished() on the reply object when
you are done with pushing results. You can push results from within run(),
in which case the preview implicitly completes when run() returns.
Alternatively, run() can store the reply object and return immediately.
* @param cancelled Function() Called by the scopes runtime when the query originator cancels a query.
Your implementation of this method should ensure that the scope stops
processing the current query as soon as possible. Any calls to a `push()` method
once a query is cancelled are ignored, so continuing to push after cancellation
only wastes CPU cycles.*/
function PreviewQuery(){}
PreviewQuery.prototype = {
/**
* Get result for this preview request
* @method result
* @return Result
*/
result: function() {
},
/**
* Get metadata for this preview request
* @method action_metadata
* @return ActionMetadata
*/
action_metadata: function() {
},
/**
* Check whether this query is still valid
* @method valid
* @return Boolean
*/
valid: function() {
},
/**
* Returns a dictionary with the scope's current settings
* @method settings
* @return Dictionary
*/
settings: function() {
}
};