-
-
Notifications
You must be signed in to change notification settings - Fork 243
/
index.js
37 lines (29 loc) · 1.62 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import { Application } from "@hotwired/stimulus"
import { identifierForContextKey } from "stimulus/webpack-helpers"
import { controllerDefinitions as bulletTrainControllers } from "@bullet-train/bullet-train"
import { controllerDefinitions as bulletTrainFieldControllers } from "@bullet-train/fields"
import { controllerDefinitions as bulletTrainSortableControllers } from "@bullet-train/bullet-train-sortable"
import ScrollReveal from 'stimulus-scroll-reveal'
import RevealController from 'stimulus-reveal'
import CableReady from 'cable_ready'
import consumer from '../channels/consumer'
const application = Application.start()
// In the browser console:
// * Type `window.Stimulus.debug = true` to log actions and lifecycle hooks
// on subsequent user interactions and Turbo page views.
// * Type `window.Stimulus.router.modulesByIdentifier` for a list of loaded controllers.
// See https://stimulus.hotwired.dev/handbook/installing#debugging
window.Stimulus = application
// Load all the controllers within this directory and all subdirectories.
// Controller files must be named *_controller.js.
import { context as controllersContext } from './**/*_controller.js';
application.load(bulletTrainControllers)
application.load(bulletTrainFieldControllers)
application.load(bulletTrainSortableControllers)
application.register('reveal', RevealController)
application.register('scroll-reveal', ScrollReveal)
const controllers = Object.keys(controllersContext).map((filename) => ({
identifier: identifierForContextKey(filename),
controllerConstructor: controllersContext[filename] }))
application.load(controllers)
CableReady.initialize({ consumer })