Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Choo: Fun Functional Framework
Search
Seiya IZUMI
October 21, 2017
Technology
580
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Choo: Fun Functional Framework
第33回 PORTもくもく会
Seiya IZUMI
October 21, 2017
More Decks by Seiya IZUMI
See All by Seiya IZUMI
Node.jsの宣言的マイグレーションツール作った
izumisy
0
82
TailorにおけるSchema-driven UIの実践例
izumisy
0
590
Elm, the functional frontend
izumisy
3
1.2k
Elmの歩き方2019
izumisy
5
3.6k
Our Journey with the Biggest Elm App in Japan
izumisy
0
210
jQueryからElmまで
izumisy
1
1.8k
Ordering and Ordered
izumisy
1
140
StackoverflowでREPを稼ぐ技術
izumisy
1
900
フロントエンド・バリデーション
izumisy
5
3.7k
Other Decks in Technology
See All in Technology
C#コードの結合を可視化する Roslyn解析による設計改善と リファクタリング判断
dora56
0
960
認知負荷を吸収し、プロダクトをまたぐPR Preview基盤の設計事例
taiki45
2
530
TiDBファミリーにDWHが新登場!! TiDB最新情報 / TiDB update 202609
yoshiakiyamasaki
0
150
GitHub Agentic Workflows を触ってみる
htkym
2
860
AIに書かせて、プラットフォームで縛る ― EKSプラットフォームで実践した責任境界と権限設計
elmodev09
1
1k
LT:「このままでいいのかな?」から一歩踏み出した私のデータキャリア選択〜社会人3年目に上京を決意したリアル〜Snowflake女子会 vol.8
snowwmn0824
0
110
AIに賢く動いてもらうためのコンテキスト〜Snowflake女子会 vol.8
snowwmn0824
0
200
ScotSecure West 2026 - Glasgow
raybugg
0
200
AI coding 整合正規方法
philipz
0
560
HacobuにおけるFDEとは/登壇資料(戸井田 裕貴)
hacobu
PRO
1
510
顧客の成果創出とプロダクトの成長を 両立するためのFDE
sansantech
PRO
0
410
AWS App Runnerから Cloudflare Workersへ移行した話
ryota09
0
110
Featured
See All Featured
Done Done
chrislema
187
17k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
1
430
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
550
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
680
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.8k
Discover your Explorer Soul
emna__ayadi
2
1.3k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
203
76k
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
250
Designing Powerful Visuals for Engaging Learning
tmiket
1
580
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
480
Being A Developer After 40
akosma
91
590k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
Transcript
Choo Fun Functional Framework Seiya Izumi (@sy_izumi)
About Me • Seiya Izumi • ଂେֶ • JS, Ruby(Rails/Sinatra)
ͱ͖Ͳ͖Golang • trainyardίϯτϦϏϡʔλʔ
Choo.jsͷͳ͠Λ͠·͢
Chooͱ • Fun Functional ProgrammingΛίϯηϓτʹ ͨ͠JSϑϩϯτΤϯυϑϨʔϜϫʔΫ • ඞཁ࠷খݶͷAPIͱϞδϡϥʔɾΞϓϦέʔ γϣϯ •
ϫϯιʔεͰ͙͢ಡΊΔʢ200ߦऑͷindex.jsʣ
ΤίγεςϜ • trainyard/choo-cli … chooͷεΩϟϑΥϧσΟϯάπʔϧ • choojs/bankai … ઃఆϑΝΠϧͳ͠ͰJSόϯυϦϯάLiveReloadͳͲΛͯ͠ ͘ΕΔϏϧυπʔϧ
• choojs/hyperx … ES6ͷλάɾςϯϓϨʔτ͔ΒԾDOMΛੜ͢ΔϞδϡʔ ϧ • choojs/nanobus … ϑΝΠϧαΠζΛͬͨEventEmitterͷସ࣮ • choojs/nanotick … ґଘੑͷͳ͍ process.nextTick ͷ࣮ ͳͲͳͲ
ϑϩϯτΤϯυͱؔܕΞϓϩʔν • ϏϡʔʢVʣεςʔτΛݩʹDOMΛฦ͢୯ ͳΔؔͰ͋Δͱߟ͑Δ • V=f(M) • εςʔτϨεͰςελϒϧ ʢ֎෦ͷґଘੑΛߟྀ͠ͳ͍ʣ
ChooݪଇFluxΞʔΩςΫνϟʹΒͳ͍ • ChooͰΘΕΔͷnanobusͰ࣮͞Εͨγϯ ϓϧͳEventEmitter • Fluxύλʔϯͷૅʹͳ͍ͬͯΔObserverύλʔϯ ͔Β͡ΊΑ͏ͷਫ਼ਆ • ඞཁͳΒࣗͰFluxΞʔΩςΫνϟΛ࣮͢Δ͜ ͱͰ͖Δ
͔ͭͬͯΈΑ͏ʂ
App.js const choo = require('choo') const app = choo() app.use(require('./stores/home'))
app.route('/', require('./pages.home')) if (module.parent) { module.exports = app } else { app.mount('body') } ϛυϧΣΞͱϧʔςΟϯάΛࢦఆͯ͠ɺDOMϚϯτ
View.js const html = require('choo/html') module.exports = function (state, emit)
{ return html` <body> <h1>Hello, World!</h1> <p>If you are seeing this, then the generator works!</p> <h2>Demo</h2> <h3>${state.title}</h3> <input type="text" oninput=${update} value=${state.title} /> </body> ` function update (e) { emit('update', { value: e.target.value }) } } ES6ͷλάϦςϥϧͰDOMߏΛهड़Ͱ͖Δ
Store.js module.exports = function (state, emitter) { state.title = ''
emitter.on('update', function({ value }) { state.title = value emitter.emit('render') }) } storeΠϕϯτϦεφఆٛͱɺstateߏͷఆٛΛߦ͏
͔ΜͨΜ
͔ΜͨΜʂ • ͙͢࡞Εͯ؆୯ʂ • ͨͷ͍͠ʂ • trainyard/choo-cli Λ͏ͱελʔλʔΩοτ Λશ෦४උͯ͘͠ΕΔͷͰΦεεϝ
ൃలฤ: SAMύλʔϯ The SAM Pattern: http://sam.js.org
Happy Coding!