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
68
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
フロンティアAIのゲート化と地政学リスク
nagatsu
0
130
やさしいA2A入門
minorun365
PRO
12
1.8k
AI-DLCを活用した高品質・安全なAI駆動開発実践 / AI Driven Development with AI-DLC
yoshidashingo
0
180
MCP Appsを作ってみよう
iwamot
PRO
4
580
人材育成分科会.pdf
_awache
1
130
Oracle AI Database@AWS:サービス概要のご紹介
oracle4engineer
PRO
4
2.9k
AI駆動開発を通して感じた、 AI時代のデザイナーの役割変化
whisaiyo
3
2k
Claude Codeをどのように キャッチアップしているか
oikon48
12
7.4k
2026TECHFRESH畢業分享會 - Lightning Talk - 打造精準高效的 MCP 設計模式與測試實務
line_developers_tw
PRO
0
930
【NRUG vol.18】KubernetesにおけるNew Relicデータ取得量削減の考え方
nrug_member
0
110
AIの性能が向上しても未解決な組織の重大問題は何か?/An Unsolved Organizational Problem in the Age of AI
moriyuya
4
640
AIはどのように 組織のアジリティを変えるのか?
junki
2
640
Featured
See All Featured
4 Signs Your Business is Dying
shpigford
187
22k
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
1
320
Documentation Writing (for coders)
carmenintech
77
5.4k
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
330
Crafting Experiences
bethany
1
180
The Art of Programming - Codeland 2020
erikaheidi
57
14k
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
720
Fashionably flexible responsive web design (full day workshop)
malarkey
408
66k
Bootstrapping a Software Product
garrettdimon
PRO
307
120k
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
610
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
1.1k
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.2k
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!