Skip to content

Commit

Permalink
Update truncate.js
Browse files Browse the repository at this point in the history
  • Loading branch information
luca-rath committed Nov 2, 2018
1 parent 5361dbc commit 7f7f4a0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/components/truncate.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@ var $ = require('jquery');
*/
function debounce(func, wait, immediate) {
var timeout;

return function() {
var context = this;
var args = arguments;

clearTimeout(timeout);
timeout = setTimeout(function() {
timeout = null;

if (!immediate) {
func.apply(context, args);
}
}, wait);

if (immediate && !timeout) {
func.apply(context, args);
}
Expand Down

0 comments on commit 7f7f4a0

Please sign in to comment.