dist/toolkit.js
function() {
        var term = this.term,
            options = this.options,
            sourceType = $.type(options.source);

        // Check the cache first
        if (this.cache[term.toLowerCase()]) {
            this.source(this.cache[term.toLowerCase()]);

        // Use the response of an AJAX request
        } else if (sourceType === 'string') {
            var url = options.source,
                cache = this.cache[url];

            if (cache) {
                this.source(cache);
            } else {
                var query = options.query;
                query.term = term;

                $.getJSON(url, query, this.source.bind(this));
            }

        // Use a literal array list
        } else if (sourceType === 'array') {
            this.source(options.source);

        // Use the return of a function
        } else if (sourceType === 'function') {
            var response = options.source.call(this);

            if (response) {
                this.source(response);
            }
        } else {
            throw new Error('Invalid TypeAhead source type');
        }
    }
function() {
        var term = this.term,
            options = this.options,
            sourceType = $.type(options.source);

        // Check the cache first
        if (this.cache[term.toLowerCase()]) {
            this.source(this.cache[term.toLowerCase()]);

        // Use the response of an AJAX request
        } else if (sourceType === 'string') {
            var url = options.source,
                cache = this.cache[url];

            if (cache) {
                this.source(cache);
            } else {
                var query = options.query;
                query.term = term;

                $.getJSON(url, query, this.source.bind(this));
            }

        // Use a literal array list
        } else if (sourceType === 'array') {
            this.source(options.source);

        // Use the return of a function
        } else if (sourceType === 'function') {
            var response = options.source.call(this);

            if (response) {
                this.source(response);
            }
        } else {
            throw new Error('Invalid TypeAhead source type');
        }
    }
function ( ) { var term = this . term , options = this . options , sourceType = $ . type ( options . source ) ; // Check the cache first if ( this . cache [ term . toLowerCase ( ) ] ) { this . source ( this . cache [ term . toLowerCase ( ) ] ) ; // Use the response of an AJAX request } else if ( sourceType === 'string' ) { var url = options . source , cache = this . cache [ url ] ; if ( cache ) { this . source ( cache ) ; } else { var query = options . query ; query . term = term ; $ . getJSON ( url , query , this . source . bind ( this ) ) ; } // Use a literal array list } else if ( sourceType === 'array' ) { this . source ( options . source ) ; // Use the return of a function } else if ( sourceType === 'function' ) { var response = options . source . call ( this ) ; if ( response ) { this . source ( response ) ; } } else { throw new Error ( 'Invalid TypeAhead source type' ) ; } }
Event handler called for a lookup.
Event handler called for a lookup .