From 37aff587b430c14455c1799f41fd01bb776a3ae6 Mon Sep 17 00:00:00 2001 From: Paul Tagliamonte Date: Thu, 27 Dec 2012 22:28:06 -0500 Subject: [PATCH] delaying pokes while typing --- demo/templates/base.html | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/demo/templates/base.html b/demo/templates/base.html index e831450..64af773 100644 --- a/demo/templates/base.html +++ b/demo/templates/base.html @@ -15,8 +15,22 @@ function reload() { } $(document).ready(function() { + var count = 0; $("#repl-input").keyup(function(e) { - reload(); + var curcount; + count = count + 1; + curcount = count; + + window.setTimeout( + function() { + if ( curcount == count ) { + reload(); + } else { + /* Pass. User is still typing */ + } + }, + 500 + ); }); reload(); });