Interface RemoteOptions

Remote data is only used when the data provided by local and prefetch is insufficient. In order to prevent an obscene number of requests being made to remote endpoint, typeahead.js rate-limits remote requests.

Index

Properties

Properties

optional public beforeSend?: (jqXhr: JQueryXHR, settings: JQueryAjaxSettings) => void

A pre-request callback. Can be used to set custom headers.

see

http://api.jquery.com/jQuery.ajax/ for more info.

optional public cache?: boolean

Determines whether or not the browser will cache responses.

see

http://api.jquery.com/jQuery.ajax/ for more info.

optional public dataType?: string

The type of data you're expecting from the server. Defaults to json.

see

http://api.jquery.com/jQuery.ajax/ for more info.

optional public filter?: (parsedResponse: any) => Twitter.Typeahead.Datum[]

Transforms the response body into an array of datums.

param

Response body

optional public maxParallelRequests?: number

The max number of parallel requests typeahead.js can have pending. Defaults to 6.

optional public rateLimitFn?: string

The function used for rate-limiting network requests. Can be either 'debounce' or 'throttle'. Defaults to 'debounce'.

optional public rateLimitWait?: number

The time interval in milliseconds that will be used by rateLimitFn. Defaults to 300.

optional public replace?: (url: string, uriEncodedQuery: string) => string

Overrides the request URL. If set, no wildcard substitution will be performed on url.

param

Replacement URL

param

Encoded query

returns

A valid URL

optional public timeout?: number

Sets a timeout for requests.

see

http://api.jquery.com/jQuery.ajax/ for more info.

public url: string

A URL to make requests to when the data provided by local and prefetch is insufficient. Required.

optional public wildcard?: string

The pattern in url that will be replaced with the user's query when a request is made. Defaults to %QUERY.