Skip to content

Instantly share code, notes, and snippets.

@les2
Last active March 28, 2017 00:28
Show Gist options
  • Select an option

  • Save les2/5b083584c933e4c887fc1f0f7360e6df to your computer and use it in GitHub Desktop.

Select an option

Save les2/5b083584c933e4c887fc1f0f7360e6df to your computer and use it in GitHub Desktop.
object-proxy-memory-leak?
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
modelProxy: null,
updateCount: 0,
setupProxy: Ember.on('init', function() {
this.updateProxy();
}),
updateProxy() {
this.incrementProperty('updateCount');
var model = this.get('model');
if (model != null) {
var proxy = Ember.ObjectProxy.create({content: model});
this.set('modelProxy', proxy);
}
Ember.run.later(this, this.updateProxy, 4);
},
});
import Ember from 'ember';
export default Ember.Route.extend({
model() {
return Ember.Object.create({a: 1, b: 2, c: 3});
}
});
<p>Updates: {{updateCount}} (proxy is replaced each time this count is incremented)</p>
<p>Port of <a href="http://jsfiddle.net/501w8c3a/18/">http://jsfiddle.net/501w8c3a/18/</a> for <a href="https://github.com/emberjs/ember.js/issues/14802">https://github.com/emberjs/ember.js/issues/14802</a></p>
<ul>
<li>{{modelProxy.a}}</li>
<li>{{modelProxy.b}}</li>
<li>{{modelProxy.c}}</li>
</ul>
{
"version": "0.12.1",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "2.12.0",
"ember-template-compiler": "2.12.0",
"ember-testing": "2.12.0"
},
"addons": {
"ember-data": "2.9.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment