This repository has been archived by the owner on Mar 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
306 lines (261 loc) · 9.8 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>emberjs - from 0.9.8 to 1.12</title>
<meta name="description" content="Triangle Ember - 06/14/2015 - Lessons learned from Ember 0.9.8 to Ember 1.12">
<meta name="author" content="Chris Hemp (@hemp)">
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui">
<link rel="stylesheet" href="css/reveal.css">
<link rel="stylesheet" href="css/theme/league.css" id="theme">
<!-- Code syntax highlighting -->
<link rel="stylesheet" href="lib/css/zenburn.css">
<!-- Printing and PDF exports -->
<script>
var link = document.createElement( 'link' );
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = window.location.search.match( /print-pdf/gi ) ? 'css/print/pdf.css' : 'css/print/paper.css';
document.getElementsByTagName( 'head' )[0].appendChild( link );
</script>
<!--[if lt IE 9]>
<script src="lib/js/html5shiv.js"></script>
<![endif]-->
</head>
<body>
<div class="reveal">
<div class="slides">
<section>
<h1>ember</h1>
<h3>Lessons learned from ember 0.9.8 to 1.12 <small>window global<br/>EAK<br/>ember-cli<br/>ember-data<br/>. . .</small></h3>
<p>
<small><a href="http://chrishemp.com">chris hemp</a> / <a href="http://twitter.com/hemp">@hemp</a></small>
</p>
<small><a href="https://github.com/hemp/triangle-ember-06-15-2015">https://github.com/hemp/triangle-ember-06-15-2015</a></small>
</section>
<section>
<h2>PureCloud Collaborate <small>aka<br/>Directory<br/>OrgSpan Connect</small></h2>
<p>Chat, Video, Phone Controls, Profiles, ...</p>
</section>
<section>
<h2>semver and 6 week cadence</h2>
<p>git-flow</p>
<p></p>
<aside class="notes">
<p>we were on the 0.9.x release for over a year and then 1.0 came out.</p>
<p>ember components, services, inspector, ...</p>
<p>PRs are reviewed and the team pushes to newer Ember way ASAP.</p>
</aside>
</section>
<section>
<h2>ember-cli<small>Ember App Kit</small></h2>
<aside class="notes">
<p>0.9.8 app was global based</p>
<p>1.0 was not and moved to import based</p>
</aside>
</section>
<section>
<h2>Controllers to Services</h2>
<p>initializers and injections</p>
<aside class="notes">
<p>do you have an authenticated session?</p>
<p>are you in a chat?</p>
<p>are you in a phone call?</p>
</aside>
</section>
<section>
<h2>Outlets vs alternatives</h2>
<p>certain items are always available (left sidebar) - like chat</p>
<p>tearing down DOM</p>
<p>outlets are like ember-wormhole before ember-wormhole</p>
<aside class="notes">
</aside>
</section>
<section>
<h2>listeners and external widgets</h2>
<ul>
<li>didInsertElement, willDestroyElement</li>
</ul>
<p>implement destroy and also verify it does what it says it does</p>
<p>lingering document, window listeners?</p>
<pre><code data-trim class="javascript">Ember.run.scheduleOnce('afterRender', this, () => {})
let ns = `.${this.get('elementId')}`;
Ember.$(window).on(`resize.${ns}`, () => {}); Ember.$(window).off(ns);</code></pre>
<aside class="notes">
<p>be careful of computed/observers recreating tooltips, etc.</p>
</aside>
</section>
<section>
<section>
<h2>chat - large lists</h2>
<p>switching chat rooms was slow (1 second or more)</p>
<p>last September - leveraged coffeescript and string concatenation to reduce that to sub 50ms</p>
<p>breaks with glimmer</p>
<aside class="notes">
<p>glimmer is slow on initial render</p>
<p>glimmer fixes RERENDER right now</p>
</aside>
</section>
<section>
<p>discourse did something similar but with a handlerbars helper that allowed plain handlerbars string generation</p>
<ul>
<li><a href="https://github.com/discourse/discourse/commit/f5379cee89d3c45fd358133abe3919e61d597cd6">sha1</a></li>
<li><a href="https://github.com/discourse/discourse/commit/09f6011bbd1821b381f1e8391b6ce93c1c4541a4">sha1</a></li>
<li><a href="https://github.com/discourse/discourse/commit/adb870a9093826b33afad8c00da098a562ff0547">sha1</a></li>
</ul>
</section>
<section>
<p>eric lifka's test <a href="https://ericlifka.github.io/recursive-vs-each">repo</a></p>
</section>
</section>
<section>
<h2>lodash.debounce vs Ember.run.debounce</h2>
<p>_.debounce is on the prototype - applies to all instances</p>
<pre><code data-trim class="javascript">export var lodash = Ember.Object.extend({
playSound: _.debounce(() => {
this._playSound();
}, 1000),
_playSound: () => {}
});
export var ember = Ember.Object.extend({
playSound: () => {
Ember.run.debounce(this, this._playSound, 1000)
},
_playSound: () => {}
});</code></pre>
</section>
<section>
<section>
<h2>websocket event streams</h2>
<p>Queue up objects necessary for render</p>
<p>Immediately return a promise for those objects</p>
<p>Drain and bulk load 'afterRender'</p>
<aside class="notes">
</aside>
</section>
<section>
<pre><code data-trim contenteditable>BatchDataRequestsMixin = Ember.Mixin.create
peopleQueue: {
'id-1': [promise, promise, ...]
'...': [promises]
}
getPerson: (id) -> new Ember.RSVP.Promise (resolve) =>
cachedModel = @store.getById 'person', id
if cachedModel
resolve cachedModel
else
queue = @get 'peopleQueue'
queue[id] ?= []
queue[id].push resolve
@scheduleQueues()
scheduleQueues: _.debounce ->
Ember.run.scheduleOnce 'afterRender', @, ->
people = @clearQueue 'peopleQueue'
if not _.isEmpty(people)
@processQueue 'person', people // -> store.findMany();
, 500,
maxWait: 5000</code></pre>
<aside class="notes">
<p>many promises for one object is OK --> all those promises have their own .then() handler.</p>
<p>allows ember to render what it knows.</p>
<p>can do this for any object type with different time window schedules/requirements.</p>
</aside>
</section>
</section>
<section>
<h2>payload size</h2>
<p>do you need all of your model now?</p>
</section>
<section>
<h2>analytics</h2>
<p><a href="https://github.com/emberjs/ember.js/issues/10742">_debugContainerKey</a></p>
<pre><code class="javascript">Router.reopen({
notifyGoogleAnalytics: function() {
var a = this.container.lookup('service:analytics');
a.pageView(this.get('url'));
}.on('didTransition')
});
var analytics = container.lookup('service:analytics');
var record = function(analytics, actionName) {
var args, containerKey, label;
args = [].slice.call(arguments, 1);
containerKey = this._debugContainerKey;//Private but so handy!
label = void 0;
if ((args != null ? args.length : void 0) > 0) {
label = args.join(', ');
}
analytics.track(containerKey, actionName, label);
};
Ember.ActionHandler.reopen({
send: function(actionName) {
var args;
args = [].slice.call(arguments, 1);
record.apply(this, [analytics, actionName].concat(args));
return this._super.apply(this, [actionName].concat(args));
}
});</code></pre>
</section>
<section>
<h2>pr reviews</h2>
</section>
<section>
<h2>observers are synchronous</h2>
<p><a href="http://guides.emberjs.com/v1.12.0/object-model/observers/">docs</a></p>
<aside class="notes">
<p>review Ember.run.once example</p>
</aside>
</section>
<section>
<h2>ember.run.*</h2>
<p><a href="http://emberjs.com/api/classes/Ember.run.html">docs</a></p>
</section>
<section>
<h2>ember.computed.*</h2>
<p><a href="http://emberjs.com/api/classes/Ember.computed.html">docs</a></p>
</section>
<section>
<h2>DS.RESTADAPTER.coalesceFindRequests</h2>
<p><a href="http://emberjs.com/api/data/classes/DS.RESTAdapter.html#property_coalesceFindRequests">coalesceFindRequests</a></p>
</section>
<section>
<h2>others?</h2>
</section>
<section>
<h2>Ember at ININ and PureCloud</h2>
<p>Collaborate</p>
<p>Sign-up</p>
<p>Document Viewer</p>
<p>OAuth (in progress)</p>
</section>
<section>
<h2>Thanks!</h2>
<p>psst...come and make sweet ember with us</p>
</section>
</div>
</div>
<script src="lib/js/head.min.js"></script>
<script src="js/reveal.js"></script>
<script>
// Full list of configuration options available at:
// https://github.com/hakimel/reveal.js#configuration
Reveal.initialize({
controls: true,
progress: true,
history: true,
center: true,
transition: 'slide', // none/fade/slide/convex/concave/zoom
// Optional reveal.js plugins
dependencies: [
{ src: 'lib/js/classList.js', condition: function() { return !document.body.classList; } },
{ src: 'plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'plugin/highlight/highlight.js', async: true, condition: function() { return !!document.querySelector( 'pre code' ); }, callback: function() { hljs.initHighlightingOnLoad(); } },
{ src: 'plugin/zoom-js/zoom.js', async: true },
{ src: 'plugin/notes/notes.js', async: true }
]
});
</script>
</body>
</html>