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
Choo: Fun Functional Framework
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Seiya IZUMI
October 21, 2017
Technology
560
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
71
TailorにおけるSchema-driven UIの実践例
izumisy
0
570
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
130
StackoverflowでREPを稼ぐ技術
izumisy
1
890
フロントエンド・バリデーション
izumisy
5
3.7k
Other Decks in Technology
See All in Technology
【CEDEC2026】グラフィックスエンジニアのためのニューラルシェーディング入門
cygames
PRO
0
120
DatadogのBits Chatが開発組織にもたらしたもの / What Bits Chat Has Brought Us
sms_tech
0
100
JavaScript 研修 (2026)
recruitengineers
PRO
1
460
事業価値と Engineering 2026年度版
recruitengineers
PRO
44
22k
Invisible to AI? Making TYPO3 Sites Quotable by AI Search Systems
wolfgangwagner
0
160
AWS ネットワーク構築でハマった(ハマりかけた) 5選とそこから得た教訓
nagisa53
4
200
Master Dataグループ紹介資料
sansan33
PRO
1
4.8k
【CEDEC2026】専門性の高いデフォルメチームが挑んだ人材育成戦略 〜Cygames Academiaの企画から実施まで〜
cygames
PRO
0
530
グローバル基準のSREは、運用現場でどう機能したか:成熟度アセスメントの実践 / SRE NEXT 2026
sorawatanabe
0
140
【CEDEC2026】『ウマ娘 プリティーダービー』 英語版のキャラクターの方言や口調をローカライズするための創造的アプローチ
cygames
PRO
1
200
『三匹の子ぶた』から学ぶネットワークセキュリティの昔と今 / Network Security: Then and Now Through the Lens of The Three Little Pigs
nttcom
1
1.8k
PLATEAU で バーチャル花火大会
tatsuya1970
0
110
Featured
See All Featured
What's in a price? How to price your products and services
michaelherold
247
13k
Product Roadmaps are Hard
iamctodd
55
12k
SEO for Brand Visibility & Recognition
aleyda
0
4.7k
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
63
45k
GitHub's CSS Performance
jonrohan
1033
470k
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
460
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
240
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.6k
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
400
Abbi's Birthday
coloredviolet
3
9.3k
The Curious Case for Waylosing
cassininazir
1
450
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
260
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!