Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Stefan Penner stefanpenner

🎯
Focusing
View GitHub Profile
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
init() {
this._super(...arguments);
this.a = 1;
this.b = 0.5;
},
abs: Ember.computed('a', 'b', function() {
View application.controller.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
View application.controller.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle',
actions: {
updateValue(value) {
this.set('output', value);
}
}
@stefanpenner
stefanpenner / component.js
Last active Feb 10, 2016 — forked from evanphx/component.js
Ember observer
View component.js
import Ember from 'ember';
export default Ember.Component.extend({
didInsertElement() {
this._super(...arguments);
// * if a computed property is never consumed, it will not be "active"
// * observers observe "active" things
// in most scenarios, computed properties are consumed often by templates (thereby typically observers appear to work without a manual kick)
// since this CP is not consumed naturally (it is essentially being consumed by a non-ember thing), we must give it a kick.
View application.controller.js
import Ember from 'ember';
export default Ember.Controller.extend({
elements: [
{name: "Uranium"},
{name: "Plutonium"},
{name: "Francium"},
{name: "Einstanium"}
],
searchQuery: ''
@stefanpenner
stefanpenner / application.controller.js
Created Jan 21, 2016 — forked from jeradg/application.controller.js
Computed Properties with @each (broken - Ember 2.2.0)
View application.controller.js
import Ember from 'ember';
let lastId = 0;
export default Ember.Controller.extend({
rootItems: Ember.computed.filter('owner.items', function(item) {
return item.get('parent.content') === null;
}).property('owner.items.@each.parent'),
owner: Ember.computed(function() {
View gist:18924ce95932bfcaea81
before
```
➜ slow-ember-cli-project git:(master) ✗ file changed app.js
Build successful - 1871ms.
Slowest Trees | Total
----------------------------------------------+---------------------
SassCompiler | 969ms
TreeMerger (appTestTrees) | 170ms
View application.controller.js
import Ember from 'ember';
function optionsProperty(dependentKey) {
return Ember.computed(dependentKey, function() {
return this.get(dependentKey).split(',').map(Function.prototype.call, String.prototype.trim);
});
}
export default Ember.Controller.extend({
init() {
View application.controller.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle'
});
View mem-leak-monday.md

well its tuesday, but I was with family yesterday...

Late last week @cibernox reported that emberjs/ember.js#11748 was still leaking for him. As it turns out, the main leak was forgetting to null out top levels vars in afterEach. But that kinda sucks, as it is tedious and error prone. So instead I wanted a better solution, one where the purden was not on the test writers. So, as it turns out we can also just release the ES2015 module after requiring it, allowing the JS GC to do the work for us.

The follow commits add the ability to unsee a module in the loader, and configure the test-loader to unsee after requiring.