This commit is contained in:
Jeremy Ashkenas
2011-12-16 12:41:20 -05:00
parent eb42c856c4
commit 3c5686f784
3 changed files with 9 additions and 6 deletions

View File

@@ -112,10 +112,9 @@ $(document).ready(function() {
throttledUpdate(1); throttledUpdate(2); throttledUpdate(3);
setTimeout(function(){ throttledUpdate(4); }, 120);
setTimeout(function(){ throttledUpdate(5); }, 140);
setTimeout(function(){ throttledUpdate(6); }, 260);
setTimeout(function(){ throttledUpdate(7); }, 270);
_.delay(function(){ ok(value == 1, "updated to latest value"); }, 40);
_.delay(function(){ ok(value == 7, "updated to latest value"); start(); }, 400);
setTimeout(function(){ throttledUpdate(6); }, 250);
_.delay(function(){ equals(value, 1, "updated to latest value"); }, 40);
_.delay(function(){ equals(value, 6, "updated to latest value"); start(); }, 400);
});
asyncTest("functions: throttle once", 1, function() {