autocomplete-sources.js revision c99f1bf364dc66a5880b8aa1ec257bd3c70cf0b1
32512d3117077508d22c9dd28803184c7072e8e4Alexandre Prokoudine * Mixes support for JSONP and YQL result sources into AutoCompleteBase.
7765ee8964c8ffd7faee9baa0412abeb1ef5b0a4Nick * @module autocomplete
7765ee8964c8ffd7faee9baa0412abeb1ef5b0a4Nick * @submodule autocomplete-sources
7765ee8964c8ffd7faee9baa0412abeb1ef5b0a4Nickfunction ACSources() {}
7765ee8964c8ffd7faee9baa0412abeb1ef5b0a4Nick * Regular expression used to determine whether a String source is a YQL
7765ee8964c8ffd7faee9baa0412abeb1ef5b0a4Nick * @property _YQL_SOURCE_REGEX
7765ee8964c8ffd7faee9baa0412abeb1ef5b0a4Nick * @type RegExp
7765ee8964c8ffd7faee9baa0412abeb1ef5b0a4Nick * @protected
7765ee8964c8ffd7faee9baa0412abeb1ef5b0a4Nick * @for AutoCompleteBase
7765ee8964c8ffd7faee9baa0412abeb1ef5b0a4Nick * Creates a DataSource-like object that uses <code>Y.io</code> as a source.
7765ee8964c8ffd7faee9baa0412abeb1ef5b0a4Nick * See the <code>source</code> attribute for more details.
7765ee8964c8ffd7faee9baa0412abeb1ef5b0a4Nick * @method _createIOSource
7765ee8964c8ffd7faee9baa0412abeb1ef5b0a4Nick * @param {String} source URL.
7765ee8964c8ffd7faee9baa0412abeb1ef5b0a4Nick * @return {Object} DataSource-like object.
7765ee8964c8ffd7faee9baa0412abeb1ef5b0a4Nick * @protected
7765ee8964c8ffd7faee9baa0412abeb1ef5b0a4Nick * @for AutoCompleteBase
7765ee8964c8ffd7faee9baa0412abeb1ef5b0a4Nick // Cancel any outstanding requests.
7765ee8964c8ffd7faee9baa0412abeb1ef5b0a4Nick } catch (ex) {
7765ee8964c8ffd7faee9baa0412abeb1ef5b0a4Nick // Keep track of the most recent request in case there are multiple
7765ee8964c8ffd7faee9baa0412abeb1ef5b0a4Nick // requests while we're waiting for the IO module to load. Only the
7765ee8964c8ffd7faee9baa0412abeb1ef5b0a4Nick // most recent request will be sent.
7765ee8964c8ffd7faee9baa0412abeb1ef5b0a4Nick // Lazy-load the io and json-parse modules if necessary, then
7765ee8964c8ffd7faee9baa0412abeb1ef5b0a4Nick // overwrite the sendRequest method to bypass this check in the
7765ee8964c8ffd7faee9baa0412abeb1ef5b0a4Nick // future.
7765ee8964c8ffd7faee9baa0412abeb1ef5b0a4Nick * Creates a DataSource-like object that uses the specified JSONPRequest
7765ee8964c8ffd7faee9baa0412abeb1ef5b0a4Nick * instance as a source. See the <code>source</code> attribute for more
7765ee8964c8ffd7faee9baa0412abeb1ef5b0a4Nick * details.
var cache = {},
jsonpSource = {},
that = this,
if (!loading) {
loading = true;
return jsonpSource;
var cache = {},
yqlSource = {},
that = this,
var yqlRequest,
if (yqlRequest) {
if (env) {
if (!loading) {
loading = true;
return yqlSource;
results = [];
return results;
if (requestTemplate) {
* Tables environment file (http://datatables.org/alltables.env).
yqlEnv: {
value: null
yqlProtocol: {