Sha256: 0df4c81b2637a34ac366a8f3789b4b49a2462c1f1ba73eac3b98ed5df9d9bb2f

Contents?: true

Size: 1.31 KB

Versions: 14

Compression:

Stored size: 1.31 KB

Contents

import { Controller } from 'stimulus'
import StimulusReflex from 'stimulus_reflex'

/* This is your application's ApplicationController.
 * All StimulusReflex controllers should inherit from this class.
 *
 * Example:
 *
 *   import ApplicationController from './application_controller'
 *
 *   export default class extends ApplicationController { ... }
 *
 * Learn more at: https://docs.stimulusreflex.com
 */
export default class extends Controller {
  connect () {
    StimulusReflex.register(this)
  }

  /* Application wide lifecycle methods.
   * Use these methods to handle lifecycle concerns for the entire application.
   * Using the lifecycle is optional, so feel free to delete these stubs if you don't need them.
   *
   * Arguments:
   *
   *   element - the element that triggered the reflex
   *             may be different than the Stimulus controller's this.element
   *
   *   reflex - the name of the reflex e.g. "ExampleReflex#demo"
   *
   *   error - error message from the server
   */

  beforeReflex (element, reflex) {
    // document.body.classList.add('wait')
  }

  reflexSuccess (element, reflex, error) {
    // show success message etc...
  }

  reflexError (element, reflex, error) {
    // show error message etc...
  }

  afterReflex (element, reflex) {
    // document.body.classList.remove('wait')
  }
}

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
stimulus_reflex-3.3.0.pre4 lib/generators/templates/app/javascript/controllers/application_controller.js.tt
stimulus_reflex-3.3.0.pre3 lib/generators/templates/app/javascript/controllers/application_controller.js.tt
stimulus_reflex-3.3.0.pre2 lib/generators/templates/app/javascript/controllers/application_controller.js.tt
stimulus_reflex-3.3.0.pre1 lib/generators/templates/app/javascript/controllers/application_controller.js.tt
stimulus_reflex-3.3.0.pre0 lib/generators/templates/app/javascript/controllers/application_controller.js.tt
stimulus_reflex-3.2.3 lib/generators/templates/application_controller.js
stimulus_reflex-3.2.2 lib/generators/templates/application_controller.js
stimulus_reflex-3.2.2.pre1 lib/generators/templates/application_controller.js
stimulus_reflex-3.2.2.pre0 lib/generators/templates/application_controller.js
stimulus_reflex-3.2.1 lib/generators/templates/application_controller.js
stimulus_reflex-3.2.0 lib/generators/templates/application_controller.js
stimulus_reflex-3.2.0.pre1 lib/generators/templates/application_controller.js
stimulus_reflex-3.2.0.pre0 lib/generators/templates/application_controller.js
stimulus_reflex-3.1.4 lib/generators/templates/application_controller.js