Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up for free
Ember ATX: Ember.Evented
timgthomas
July 24, 2015
Technology
0
59
Ember ATX: Ember.Evented
Lightning talk about one of my favorite Ember mixins, Ember.Evented!
timgthomas
July 24, 2015
Tweet
Share
More Decks by timgthomas
See All by timgthomas
Living Style Guides: Bringing Designers and Developers Together
timgthomas
0
72
Icons and the Web: Symbols of the Modern Age
timgthomas
0
68
Constructing Modern UIs with SVG
timgthomas
0
100
Browser Invasion: Desktop Apps and the Web
timgthomas
0
78
Mind the Gap: Bringing Designers and Developers Together
timgthomas
0
58
Zero to App Store: A Hybrid App’s Tale
timgthomas
1
87
Chocolate-Covered Vegetables: Tasty Workflows with Broccoli
timgthomas
0
69
Ember ATX: Components
timgthomas
0
67
Chocolate-Covered Vegetables: Tasty Workflows with Broccoli
timgthomas
0
250
Other Decks in Technology
See All in Technology
OCIコンテナサービス関連の技術詳細 /oke-ocir-details
oracle4engineer
PRO
0
750
エアドロップ for オープンソースプロジェクト
epicsdao
0
250
Exploring MapStore Release 2022.02: improved 3DTiles support and more
simboss
PRO
0
180
Deep dive in Reserved Instance ~脳死推奨量購入からの脱却~
kzkmaeda
0
380
ラズパイとGASで加湿器の消し忘れをLINEでリマインド&操作
minako__ph
0
130
PCL (Point Cloud Library)の基本となぜ点群処理か_2023年_第2版.pdf
cvmlexpertguide
0
130
目指せCoverage100%! AutoScale環境におけるSavings Plans購入戦略 / JAWS-UG_SRE_Coverage
taishin
0
350
JAWS-UG 横浜 #54 資料
takakuni
0
160
創業1年目のスタートアップでAWSコストを抑えるために取り組んでいること / How to Keep AWS Costs Down at a Startup
yuj1osm
3
1.8k
OVN-Kubernetes-Introduction-ja-2023-01-27.pdf
orimanabu
1
230
【NGK2023S】 ノードエディタ形式の画像処理ツール「Image-Processing-Node-Editor」
kazuhitotakahashi
0
230
日本ディープラーニング協会主催 NeurIPS 2022 技術報告会講演資料
tdailab
0
980
Featured
See All Featured
What's in a price? How to price your products and services
michaelherold
233
9.7k
Robots, Beer and Maslow
schacon
154
7.3k
VelocityConf: Rendering Performance Case Studies
addyosmani
317
22k
From Idea to $5000 a Month in 5 Months
shpigford
374
44k
Rails Girls Zürich Keynote
gr2m
87
12k
Six Lessons from altMBA
skipperchong
15
2.3k
Code Review Best Practice
trishagee
50
11k
Bash Introduction
62gerente
601
210k
GitHub's CSS Performance
jonrohan
1020
430k
Done Done
chrislema
178
14k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
349
27k
Pencils Down: Stop Designing & Start Developing
hursman
114
10k
Transcript
Hi!
@timgthomas
Scenario
// models/item.js export default Ember.Object.extend({ actions: { save() { this.set('savedAt',
new Date()); } } }); // components/show-item.js export default Ember.Component.extend({ itemSaved: function() { // ... }.observes('item.savedAt') });
”Data Down, Actions Up“
Ember.Evented
// models/item.js export default Ember.Object.extend(Ember.Evented, { actions: { save() {
this.trigger('saved'); } } }); // components/show-item.js export default Ember.Component.extend({ init() { this._super(); this.get('item').on('saved', this.itemSaved); } });
// controllers/list.js export default Ember.Controller.extend(Ember.Evented, { actions: { save() {
this.trigger('saved'); } } }); // controllers/item.js export default Ember.Controller.extend({ init() { this._super(); this.get('controllers.list').on('saved', () => {}); } });
Route Hierarchy Gotcha!
let controller = this.get('controllers.foo'); controller.trigger('foo'); controller.trigger('foo', 'bar'); controller.on('foo', () =>
{}); controller.off('foo', () => {}); controller.one('foo', () => {}); controller.has('foo');
bit.ly/ember-evented
Thanks!