Skip to content

Commit

Permalink
Extract debounce time into a constant
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrudz committed Apr 24, 2020
1 parent e6a292c commit 50b009a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion spec/JustNotSorrySpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ describe('JustNotSorry', function () {
expect(warningChecker.addWarnings).toHaveBeenCalledTimes(1);
expect(warningChecker.addWarnings).toHaveBeenCalledWith(target.parentNode);
done();
}, 510);
}, WAIT_TIME_BEFORE_RECALC_WARNINGS + 10);
});
});
});
Expand Down
3 changes: 2 additions & 1 deletion src/JustNotSorry.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

var warningChecker = new WarningChecker(WARNINGS);
var editableDivCount = 0;
var WAIT_TIME_BEFORE_RECALC_WARNINGS = 500;

// from underscore.js
// Returns a function, that, as long as it continues to be invoked, will not
Expand Down Expand Up @@ -57,7 +58,7 @@ var removeObserver = function() {
var checkForWarnings = debounce(function() {
warningChecker.removeWarnings(this.parentNode);
warningChecker.addWarnings(this.parentNode);
}, 500);
}, WAIT_TIME_BEFORE_RECALC_WARNINGS);

var applyEventListeners = function(id) {
var targetDiv = document.getElementById(id);
Expand Down

0 comments on commit 50b009a

Please sign in to comment.