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
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
69
TailorにおけるSchema-driven UIの実践例
izumisy
0
550
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
200
jQueryからElmまで
izumisy
1
1.7k
Ordering and Ordered
izumisy
1
120
StackoverflowでREPを稼ぐ技術
izumisy
1
880
フロントエンド・バリデーション
izumisy
5
3.7k
Other Decks in Technology
See All in Technology
Lightning近況報告
kozy4324
0
210
OTel × Datadog で 「AI活用」を計測し、改善に繋げる
shihochan
2
450
気軽に使える"情報のハブ"としてのNotion活用 〜フロー情報の集積点 と、 Claude Code × Notion AI〜
syucream
1
160
FPGAの開発コンペでZephyrを使ってみた
iotengineer22
0
150
AI駆動開発を通して感じた、 AI時代のデザイナーの役割変化
whisaiyo
4
2.3k
現場のトークンマネジメント
dak2
0
140
AIAU_UMEMOGU_ninomiya_slide
ninomiya_ii
0
240
手塩にかけりゃいいってもんじゃない
ming_ayami
0
610
自宅LLMの話
jacopen
1
670
【Snowflake Summit 2026 Recap!!】Snowflake Summit Deep Dive: Security & Governance
civitaspo
1
270
AWS Security Agent といっしょに脅威モデリングをやってみよう
amarelo_n24
1
180
When Platform Engineering Meets GenAI
sucitw
0
130
Featured
See All Featured
Code Reviewing Like a Champion
maltzj
528
40k
How to train your dragon (web standard)
notwaldorf
97
6.7k
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
62
44k
Everyday Curiosity
cassininazir
0
230
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
340
Skip the Path - Find Your Career Trail
mkilby
1
150
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
2.9k
The Language of Interfaces
destraynor
162
27k
Art, The Web, and Tiny UX
lynnandtonic
304
22k
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
160
Product Roadmaps are Hard
iamctodd
PRO
55
12k
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
300
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!