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
55
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
64
Icons and the Web: Symbols of the Modern Age
timgthomas
0
63
Constructing Modern UIs with SVG
timgthomas
0
80
Browser Invasion: Desktop Apps and the Web
timgthomas
0
68
Mind the Gap: Bringing Designers and Developers Together
timgthomas
0
51
Zero to App Store: A Hybrid App’s Tale
timgthomas
1
80
Chocolate-Covered Vegetables: Tasty Workflows with Broccoli
timgthomas
0
63
Ember ATX: Components
timgthomas
0
67
Chocolate-Covered Vegetables: Tasty Workflows with Broccoli
timgthomas
0
240
Other Decks in Technology
See All in Technology
2022年度ロボットフロンティア第1回
ryuichiueda
0
140
スクラムマスターの「観察」スキルを掘り下げる / Scrum Fest Niigata 2022
ama_ch
0
620
Scrum Fest Niigata 2022 開発エンジニアに聞いてみよう!
moritamasami
1
210
Building smarter apps with machine learning, from magic to reality
picardparis
4
3.1k
キャッチアップ Android 13 / Catch up Android 13
yanzm
2
1.1k
[SRE NEXT 2022]KaaS桶狭間の戦い 〜Yahoo! JAPANのSLI/SLOを用いた統合監視〜
srenext
0
230
モダンデータスタックとかの話(データエンジニアのお仕事とは)
foursue
0
420
GitHub 엔터프라이즈 어카운트 소개 및 엔터프라이즈 서버 구축 경험
posquit0
1
140
CADDi HCMC Technology Center
caddi_eng
0
250
LINE WORKS API 2.0について
mmclsntr
0
120
AWS ChatbotでEC2インスタンスを 起動できるようにした
iwamot
0
150
[SRE NEXT 2022]組織に対してSREを適用するとはどういうことか
srenext
0
180
Featured
See All Featured
Building an army of robots
kneath
299
40k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
237
19k
Designing with Data
zakiwarfel
91
3.9k
Become a Pro
speakerdeck
PRO
3
780
The Pragmatic Product Professional
lauravandoore
19
2.9k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
350
21k
For a Future-Friendly Web
brad_frost
164
7.4k
Streamline your AJAX requests with AmplifyJS and jQuery
dougneiner
125
8.5k
The Mythical Team-Month
searls
208
39k
Git: the NoSQL Database
bkeepers
PRO
415
59k
Web Components: a chance to create the future
zenorocha
303
40k
Making Projects Easy
brettharned
98
4.3k
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!