just-throttle
Advanced tools
Comparing version 1.0.1 to 1.0.2
{ | ||
"name": "just-throttle", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "return a throttled function", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -11,13 +11,9 @@ ## just-throttle | ||
const fn1 = throttle(() => console.log('Hello'), 500); | ||
const fn1 = throttle(() => console.log('hello'), 500, true); | ||
setInterval(fn1, 400); | ||
// logs 'hello' immediately and then every 500ms | ||
const fn2 = throttle(() => console.log('Hello'), 500, {leading: false}); | ||
const fn2 = throttle(() => console.log('hello'), 500); | ||
setInterval(fn2, 400); | ||
// logs 'hello' after 500ms and then every 500ms | ||
const fn3 = throttle(() => console.log('Hello'), 500, {trailing: false}); | ||
setInterval(fn3, 400); | ||
// logs 'hello' immediately and then every 500ms, but not after final interval | ||
``` |
1428
19