Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7854639
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T20:07:49+00:00 2026-06-02T20:07:49+00:00

Underscore provides the method, throttle. From their docs: Creates and returns a new, throttled

  • 0

Underscore provides the method, throttle. From their docs:

Creates and returns a new, throttled version of the passed function, that, when invoked repeatedly, will only actually call the original function at most once per every wait milliseconds. Useful for rate-limiting events that occur faster than you can keep up with.

Now imagine the case of an autocomplete form. This means that if ‘abc’ is typed within a, say, 100ms window, then only a search for ‘a’ will be sent, and not ‘bc’.

Is this a drastic oversight on the part of underscore.js? What would you suggest as a clean solution?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T20:07:51+00:00Added an answer on June 2, 2026 at 8:07 pm

    For this use case, you may want to use the following “buffer” function, which will apply only the last call within the wait window.

    https://gist.github.com/2484196

    _.buffer = function(func, wait, scope) {
      var timer = null;
      return function() {
        if(timer) clearTimeout(timer);
        var args = arguments;
        timer = setTimeout(function() {
          timer = null;
          func.apply(scope, args);
        }, wait);
      };
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using underscore.js's templating capabilities from backbone.js, I have the following template that
I've read that _ (underscore) is only used to tell that the variable/method/class is
I have found some code from Underscore.js _.map = _.collect = function(obj, iterator, context)
In underscore.js the for each method starts with the following: var each = _.each
Does [_\s^] mean underscore and whitespace but not (quote) in Reg I understand that
I started reading about underscore.js today, it is a library for javascript that adds
I thought double underscore always meant private function but what does it mean in
I am new to underscore.js. What is the purpose of [context] in _.each() ?
I'm reading the documentation for the Underscore.js library from DocumentCloud . Many of the
I'm new to underscore so pardon my ignorance. Is there a quick and easy

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.