refactor(js): move around stimulus initializers

This commit is contained in:
Paul Chavard 2022-05-06 19:40:17 +02:00
parent 39761f45a0
commit ce58ab98c1
2 changed files with 14 additions and 14 deletions

View file

@ -0,0 +1,12 @@
import { Application } from '@hotwired/stimulus';
import { ReactController } from './react_controller';
import { TurboEventController } from './turbo_event_controller';
import { GeoAreaController } from './geo_area_controller';
import { TurboInputController } from './turbo_input_controller';
const Stimulus = Application.start();
Stimulus.register('react', ReactController);
Stimulus.register('turbo-event', TurboEventController);
Stimulus.register('geo-area', GeoAreaController);
Stimulus.register('turbo-input', TurboInputController);

View file

@ -2,7 +2,6 @@ import '../shared/polyfills';
import Rails from '@rails/ujs';
import * as ActiveStorage from '@rails/activestorage';
import 'whatwg-fetch'; // window.fetch polyfill
import { Application } from '@hotwired/stimulus';
import * as Turbo from '@hotwired/turbo';
import '../shared/activestorage/ujs';
@ -11,13 +10,8 @@ import '../shared/safari-11-file-xhr-workaround';
import '../shared/toggle-target';
import '../shared/ujs-error-handling';
import {
ReactController,
registerComponents
} from '../controllers/react_controller';
import { TurboEventController } from '../controllers/turbo_event_controller';
import { GeoAreaController } from '../controllers/geo_area_controller';
import { TurboInputController } from '../controllers/turbo_input_controller';
import { registerComponents } from '../controllers/react_controller';
import '../controllers';
import '../new_design/dropdown';
import '../new_design/form-validation';
@ -88,11 +82,5 @@ Rails.start();
ActiveStorage.start();
Turbo.session.drive = false;
const Stimulus = Application.start();
Stimulus.register('react', ReactController);
Stimulus.register('turbo-event', TurboEventController);
Stimulus.register('geo-area', GeoAreaController);
Stimulus.register('turbo-input', TurboInputController);
// Expose globals
window.DS = window.DS || DS;