Skip to content

Instantly share code, notes, and snippets.

@lsmith
Created July 25, 2009 06:11
Show Gist options
  • Save lsmith/154716 to your computer and use it in GitHub Desktop.
Save lsmith/154716 to your computer and use it in GitHub Desktop.
<!doctype html>
<html>
<head>
<title>Test Page</title>
</head>
<body>
<h1>The typing-pause special event</h1>
<p>Type stuff in the input below and watch for messages in the console.</p>
<input id="delay">
<script src="http://yui.yahooapis.com/3.0.0b1/build/yui/yui-min.js" type="text/javascript"></script>
<script src="typing-pause.js"> [Found in gist 154714] </script>
<script>
YUI().use('node','typing-pause', function (Y) {
var i = 0;
Y.on('typing-pause', function (e) {
console.log('Delay ' + (++i));
}, '#delay', { // this is the configuration, with the defaults
adaptive: true,
minLength: 1,
minWait: 400,
maxWait: 3000,
initialWait: 3000,
waitMultiplier: 4,
filter: function (inputValue) { return inputValue; }
});
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment