lb- / stimulus-starter

A humble blank slate for a modest JavaScript framework

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Stimulus Starter

A preconfigured blank slate for exploring Stimulus. Jump to The Stimulus Handbook for an introduction.


We recommend remixing stimulus-starter on Glitch so you can work entirely in your browser without installing anything:

Remix on Glitch

Or, if you'd prefer to work from the comfort of your own text editor, you'll need to clone and set up stimulus-starter:

$ git clone https://github.com/hotwired/stimulus-starter.git
$ cd stimulus-starter
$ yarn install
$ yarn start

Notes

Some useful things

this.identifier - available on controller class instance

  • this will be the registered controller's identifier (used when registering)

this.dispatch - additional params

  • https://github.com/hotwired/stimulus/blob/main/src/core/controller.ts#L64
  • target - defaults to the controlled element but can be given anything that a dispatched event can be fired from (e.g. another element)
  • prefix - best not to override but good to know it can be done
  • bubbles - see MDN
  • cancelable - see MDN
  • Important - it returns the event, NOT the result of the dispatch (actually more useful but good to know if you want to handle preventDefault cases)

About

A humble blank slate for a modest JavaScript framework

License:MIT License


Languages

Language:JavaScript 55.2%Language:HTML 44.4%Language:CSS 0.4%