Skip to content

Commit

Permalink
Merge pull request #93 from fffx/fix_interval_reference_error
Browse files Browse the repository at this point in the history
Fix: "Uncaught ReferenceError: _interval" #92
  • Loading branch information
nikolalsvk authored Oct 1, 2019
2 parents d116b35 + 6967579 commit 3fed514
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/views/render_async/_request_jquery.js.erb
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ if (window.jQuery) {
<% if toggle %>
$(document).on('<%= toggle[:event] || 'click' %>', '<%= toggle[:selector] %>', function(event) {
event.preventDefault();
if (_interval) {
if (typeof _interval === 'number') {
clearInterval(_interval);
_interval = undefined;
} else {
Expand Down
2 changes: 1 addition & 1 deletion app/views/render_async/_request_vanilla.js.erb
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
[...selectors].forEach(function(selector) {
selector.addEventListener('<%= toggle[:event] || 'click' %>', function(event) {
event.preventDefault();
if (_interval) {
if (typeof _interval === 'number') {
clearInterval(_interval);
_interval = undefined;
} else {
Expand Down

0 comments on commit 3fed514

Please sign in to comment.