Use @utils instead of jQuery
This commit is contained in:
parent
c343893d00
commit
8c16eb4cd0
6 changed files with 17 additions and 24 deletions
|
@ -1,7 +1,4 @@
|
|||
import Rails from 'rails-ujs';
|
||||
import { show, hide } from '../shared/utils';
|
||||
|
||||
const { delegate } = Rails;
|
||||
import { show, hide, delegate } from '@utils';
|
||||
|
||||
function showSpinner() {
|
||||
[...document.querySelectorAll('.spinner')].forEach(show);
|
||||
|
@ -11,6 +8,6 @@ function hideSpinner() {
|
|||
[...document.querySelectorAll('.spinner')].forEach(hide);
|
||||
}
|
||||
|
||||
delegate(document, '[data-spinner]', 'ajax:complete', hideSpinner);
|
||||
delegate(document, '[data-spinner]', 'ajax:stopped', hideSpinner);
|
||||
delegate(document, '[data-spinner]', 'ajax:send', showSpinner);
|
||||
delegate('ajax:complete', '[data-spinner]', hideSpinner);
|
||||
delegate('ajax:stopped', '[data-spinner]', hideSpinner);
|
||||
delegate('ajax:send', '[data-spinner]', showSpinner);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue