mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-23 21:00:01 +08:00
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:
32
typeahead/typeahead.d.ts
vendored
32
typeahead/typeahead.d.ts
vendored
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user