From 0211cad7d60fe96838587f159d657e44cee51b9b Mon Sep 17 00:00:00 2001 From: Marco Roth Date: Thu, 24 Aug 2023 12:42:28 +0200 Subject: [PATCH] Export `StimulusReflexController` constant (#672) ## Description This pull request exports the `StimulusReflexController` constant so it can be imported from the `stimulus_reflex` package. ## Why should this be added We already allow developers to customize the default controller used for the `stimulus-reflex` identifier by passing in the `controller` option in the `StimulusReflex.initialize(application, options)` call. This pull requests now allows developers to base their default controller off the StimulusReflex controller by inheriting from the `StimulusReflexController` constant, like: ```js // controllers/default_controller.js import { StimulusReflexController } from "stimulus_reflex" export default class extends StimulusReflexController { // extend the `stimulus-reflex` controller } ``` and: ```js import DefaultController from "../controllers/default_controller" StimulusReflex.initialize(application, { controller: DefaultController }) ``` --- javascript/stimulus_reflex.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/javascript/stimulus_reflex.js b/javascript/stimulus_reflex.js index f6bcd261..3b50be9b 100644 --- a/javascript/stimulus_reflex.js +++ b/javascript/stimulus_reflex.js @@ -32,7 +32,7 @@ import { // that have configured data-reflex. Note that this default can be overridden when initializing the application. // i.e. StimulusReflex.initialize(myStimulusApplication, MyCustomDefaultController) // -class StimulusReflexController extends Controller { +export class StimulusReflexController extends Controller { constructor (...args) { super(...args) register(this)