import "@hotwired/turbo-rails" import { Application } from "@hotwired/stimulus" import LanguageMenuController from "language_menu_controller" import CarouselController from "carousel_controller" import IntroController from "intro_controller" import ChanceController from "chance_controller" import ShareController from "share_controller" import ModalController from "modal_controller" const application = Application.start() application.register("language-menu", LanguageMenuController) application.register("carousel", CarouselController) application.register("intro", IntroController) application.register("chance", ChanceController) application.register("share", ShareController) application.register("modal", ModalController) // The whole game runs inside one turbo-frame so the URL never changes. Frame // navigations don't reset scroll the way a full page visit does, so each new // screen would otherwise open at the previous screen's scroll offset. document.addEventListener("turbo:frame-render", (event) => { if (event.target.id === "game") window.scrollTo(0, 0) }) // Configure Stimulus development experience application.debug = false window.Stimulus = application export { application }