github hotwired/stimulus v1.0.0

latest releases: v3.2.2, v3.2.1, v3.2.0...
6 years ago
  • NEW: Linked target properties (#61, #68)

    Define a controller's target names and Stimulus automatically creates properties for accessing them:

    export default class extends Controller {
      static targets = [ "source" ]
    
      initialize() {
        this.sourceTarget    // Element
        this.sourceTargets   // Element[]
        this.hasSourceTarget // boolean
      }
    }
  • NEW: Configurable error handler (#53)

    const application = Application.start()
    
    application.handleError = (error, message, detail) => {
      console.warn(message, detail)
      Raven.captureException(error)
    }
  • NEW: Namespaced identifiers (#65)

    If your controller file is named… its identifier will be…
    list_item_controller.js list-item
    users/list_item_controller.js users--list-item
  • CHANGED: Controller autoloading with webpack (#46)

    A new definitionsFromContext helper replaces the old autoload helper:

    const application = Application.start()
    -const context = require.context("./controllers", true, /\.js$/)
    -autoload(context, application)
    +const context = require.context("./controllers", true, /\.js$/)
    +application.load(definitionsFromContext(context))
  • REMOVED: Action method event target argument (#55)

    Previously, action methods were invoked with two arguments: event, eventTarget. Now, only the event is passed:

    -greet(event, eventTarget) {
    -  console.log(event, eventTarget)
    +greet(event) {
    +  console.log(event, event.target)
     }
  • REMOVED: Controller#{add,remove}Action (#50)

    Noted for posterity since these methods were undocumented.

Don't miss a new stimulus release

NewReleases is sending notifications on new releases.