Skip to content

Commit

Permalink
Fix classes property
Browse files Browse the repository at this point in the history
  • Loading branch information
Timofey Dergachev committed Jul 1, 2017
1 parent 0368f67 commit b1dd324
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions addon/mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const {
mixin,
assert,
computed,
Object: EmObject,
} = Ember;

// Imitation private properties
Expand Down Expand Up @@ -88,12 +89,14 @@ export default Mixin.create({
const id = this.elementId;

this.stylesheet.attach(id, componentName);
this.set('classes', this.stylesheet.sheet.classes);

const classes = EmObject.create(this.stylesheet.sheet.classes);
const sheet = this.stylesheet.dynamicSheets[id];
const fields = this.get('jssObservedProps') || [];
const update = () => sheet.update(this.getProperties(fields));

this.set('classes', classes);

update();

fields.forEach((field) => this.addObserver(field, this, update));
Expand All @@ -103,5 +106,5 @@ export default Mixin.create({
this._super(...arguments);

this.stylesheet.detach(this.elementId);
}
},
});

0 comments on commit b1dd324

Please sign in to comment.