Skip to content

Commit

Permalink
Fix: "Uncaught ReferenceError: _interval"
Browse files Browse the repository at this point in the history
  • Loading branch information
fffx committed Oct 1, 2019
1 parent d116b35 commit 6967579
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 6967579

Please sign in to comment.