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
40
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
6
Build in Private
matheusrich
0
17
Start TDDing in 5 minutes
matheusrich
0
85
3 Steps Every Test Should Take
matheusrich
0
47
Taming God Objects: easy, incremental and secure
matheusrich
1
68
BEM - A simple CSS methodology
matheusrich
0
41
De Repente 7
matheusrich
0
8
Other Decks in Programming
See All in Programming
スクラムガイドのスプリントレトロスペクティブを改めて読みかえしてみた / Re-reading the Sprint Retrospective Section in the Scrum Guide
mackey0225
3
430
Elm Form Validation
bkuhlmann
0
510
大規模UIKitベースアプリへのTCAの段階的導入/gradual-adoption-of-tca-in-a-large-scale-uikit-based-app
takehilo
1
180
Ruby GitHub Packages
bkuhlmann
0
630
Fragment Composition of GraphQL
quramy
7
1k
Zero Waste, Radical Magic, and Italian Graft – Quarkus Efficiency Secrets
hollycummins
0
230
二郎系ラーメンのコールで学ぶ AST 解析
memory1994
PRO
7
1.7k
スキーマ駆動開発による品質とスピードの両立 - 私達は何故、スキーマを書くのか
kentaroutakeda
0
170
Netty Chicago Java User Group 2024-04-17
sullis
0
180
Komplexe Oberflächen mit SVG und der Web Animation API
joergneumann
0
670
Goのエラースタックトレースの歴史と今後
sonatard
9
1.5k
『Railsオワコン』と言われる時代に、なぜブルーモ証券はRailsを選ぶのか
free_world21
0
250
Featured
See All Featured
The Cult of Friendly URLs
andyhume
74
5.7k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
40
4.4k
4 Signs Your Business is Dying
shpigford
175
21k
Code Reviewing Like a Champion
maltzj
514
39k
What's in a price? How to price your products and services
michaelherold
237
11k
How to Ace a Technical Interview
jacobian
272
22k
We Have a Design System, Now What?
morganepeng
43
6.8k
How to train your dragon (web standard)
notwaldorf
73
5.2k
Bash Introduction
62gerente
604
210k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
34
8.9k
Git: the NoSQL Database
bkeepers
PRO
422
63k
Imperfection Machines: The Place of Print at Facebook
scottboms
260
12k
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