Update typeahead.d.ts

added support for call typeahead(options, dataset) where options include hint, highlight and minLength all of which are optional.
This commit is contained in:
maanasa
2014-03-24 15:29:49 +05:30
parent 4085f85dc4
commit a00413743e

View File

@@ -50,6 +50,16 @@ interface JQuery {
* @param query The query to be set in case method 'setQuery' is used.
*/
typeahead(methodName: string, query: string): JQuery;
/**
* Accomodates specifying options such as hint and highlight.
* This is in correspondence to the examples mentioned in http://twitter.github.io/typeahead.js/examples/
*
* @constructor
* @param options ('hint' or 'highlight' or 'minLength' all of which are optional)
* @param dataset Array of datasets
*/
typeahead(options: Twitter.Typeahead.Options, dataset: Twitter.Typeahead.Dataset): JQuery;
}
declare module Twitter.Typeahead {
@@ -243,4 +253,26 @@ declare module Twitter.Typeahead {
*/
tokens: string[];
}
/**
* When initializing a typeahead, there are a number of options you can configure.
*/
interface Options {
/**
* highlight: If true, when suggestions are rendered,
* pattern matches for the current query in text nodes will be wrapped in a strong element.
* Defaults to false.
*/
highlight?: boolean;
/**
* If false, the typeahead will not show a hint. Defaults to true.
*/
hint?: boolean;
/**
* The minimum character length needed before suggestions start getting rendered. Defaults to 1.
*/
minLength?: number;
}
}