When implementing features such as auto completion it can be important to not send a request to the server each time a key is pressed. To do this many websites implement something called throttling to only send requests if a key hasn't been pressed in x milliseconds. Your goal is to create a program that does this. When the throttled timer reaches 500ms print out everything in the buffer or text input. So if you're type 'abcd' in to a console really quickly (each keystroke happening in under 500ms) then 500ms passes, you would print 'abcd'.
Comments:
asheehan - 10 years, 2 months ago
did this one with jQuery. Fiddle here: http://jsfiddle.net/wbthhLe0/
reply permalink