O'Reilly logo

Instant typeahead.js by Toby Osbourn

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Minimizing lookups (Become an expert)

We have discussed in the preceding two recipes about how we can better deal with caching our lookups, but wouldn't it be good if we could minimize the amount of lookups we needed to make without having to resort to looking in LocalStorage?

In this recipe, we will address some of the things that we can do in order to minimize the amount of lookups needed.

Getting ready

We already have everything we need to start thinking about how we can minimize lookups.

One thing we need to remember is the order in which typeahead will do things:

  1. First it will check for local data. If it can fit the needs of the search using local data then it will not go any further.
  2. Next it will look for prefetched data, and again if a combination ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required