Skip to content

Commit de88b48

Browse files
committed
Add cleanup of observers on destroy
1 parent 32f6f23 commit de88b48

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

addon/mixins/csp-style.js

+12
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,18 @@ export default Ember.Mixin.create({
9999
this._refreshBindings();
100100
}),
101101

102+
doCleanup: Ember.on('willDestroyElement', function() {
103+
var observers = this.get('_styleObservers') || {};
104+
// remove all bindings
105+
for(var property in observers) {
106+
if (observers.hasOwnProperty(property)) {
107+
observers[property].stop();
108+
delete observers[property];
109+
}
110+
}
111+
this.set('_styleObservers', {});
112+
}),
113+
102114
_refreshBindings: function() {
103115

104116
var hashCode = function(s){

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ember-cli-csp-style",
3-
"version": "1.13.9",
3+
"version": "1.13.10",
44
"description": "",
55
"directories": {
66
"doc": "doc",

0 commit comments

Comments
 (0)