Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Stimulus 2.0-alpha - What's new?
Search
Matheus Richard
April 02, 2020
Programming
0
49
Stimulus 2.0-alpha - What's new?
Light talk about the upcoming features of Stimulus.js.
Matheus Richard
April 02, 2020
Tweet
Share
More Decks by Matheus Richard
See All by Matheus Richard
The Fast Lane: Asynchronous Rails
matheusrich
0
35
Build in Private
matheusrich
0
63
Start TDDing in 5 minutes
matheusrich
0
94
3 Steps Every Test Should Take
matheusrich
0
76
Taming God Objects: easy, incremental and secure
matheusrich
1
93
BEM - A simple CSS methodology
matheusrich
0
48
De Repente 7
matheusrich
0
12
Other Decks in Programming
See All in Programming
A2A プロトコルを試してみる
azukiazusa1
2
1.2k
XSLTで作るBrainfuck処理系
makki_d
0
210
ふつうの技術スタックでアート作品を作ってみる
akira888
0
170
なんとなくわかった気になるブロックテーマ入門/contents.nagoya 2025 6.28
chiilog
1
230
明示と暗黙 ー PHPとGoの インターフェイスの違いを知る
shimabox
2
380
Cline指示通りに動かない? AI小説エージェントで学ぶ指示書の書き方と自動アップデートの仕組み
kamomeashizawa
1
580
LINEヤフー データグループ紹介
lycorp_recruit_jp
0
1.2k
ニーリーにおけるプロダクトエンジニア
nealle
0
590
What Spring Developers Should Know About Jakarta EE
ivargrimstad
0
300
Bytecode Manipulation 으로 생산성 높이기
bigstark
2
380
第9回 情シス転職ミートアップ 株式会社IVRy(アイブリー)の紹介
ivry_presentationmaterials
1
250
Cursor AI Agentと伴走する アプリケーションの高速リプレイス
daisuketakeda
1
130
Featured
See All Featured
RailsConf 2023
tenderlove
30
1.1k
Optimizing for Happiness
mojombo
379
70k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
357
30k
The Cult of Friendly URLs
andyhume
79
6.5k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
45
7.5k
How to train your dragon (web standard)
notwaldorf
94
6.1k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
10
930
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
53
2.8k
A better future with KSS
kneath
239
17k
Navigating Team Friction
lara
187
15k
What’s in a name? Adding method to the madness
productmarketing
PRO
23
3.5k
Automating Front-end Workflow
addyosmani
1370
200k
Transcript
Stimulus 2.0-alpha What’s new?
TLDR Two new APIs with a nice surprise
Data Map API
Data Map API • A way to pass data to
a controller. • Use cases: ◦ Storing small strings, such as URLs, dates, or color values; ◦ Bootstrapping a controller with a JSON object or array.
HTML Controller
However, the Data Map API only works with string values.
That means we must manually convert to and from other types as needed
Values API
Values API • Makes possible to define values (data maps)
in the controller itself; • Create properties to accessing them.
Usage The Value object keys are Data Map keys, and
the values declare their data types
Value Properties They work just as the Target API works
A nice surprise: Value Changed Callback
Usage Now it’s easier to make your good old HTML
template look modern
How many times have you seen the following pattern?
HTML Controller
We’re coupling the controller to the class name
Maybe using the Data Map API?
HTML Controller
Classes API
HTML Controller
All that with a very small cost
Unifying target attributes Both syntaxes will be supported, but using
the original syntax will display a deprecation message in the developer console
Excited? Start using it now! Just add it to your
package.json
More info at https://github.com/stimulusjs/stimulus/pull/202
That’s it Feel free to ask any question