Skip to content

Instantly share code, notes, and snippets.

@vinhlh
Created November 18, 2016 10:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vinhlh/6603385fa039508c3c8ea34db7083635 to your computer and use it in GitHub Desktop.
Save vinhlh/6603385fa039508c3c8ea34db7083635 to your computer and use it in GitHub Desktop.
Typehead twitter search implement
this.getRemoteSuggestions = function(a, b, c, d) {
if (!b || !this.needsRemoteRequest(b, d))
return;
this.request[a] || (this.attr.useThrottle ?
this.request[a] = utils.throttle(this.splitRemoteRequests.bind(this), this.attr.remoteThrottleInterval) :
this.request[a] = utils.debounce(this.splitRemoteRequests.bind(this), this.attr.remoteDebounceInterval)),
b.query.indexOf("@") === 0 && b.typeaheadSrc === "COMPOSE" && (b.query = b.query.substring(1),
b.atSignRemoved = !0),
this.request[a](a, b, c, d)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment