Skip to content

Commit

Permalink
Add explanatory comment about use of Object.defineProperty to replace…
Browse files Browse the repository at this point in the history
… 'volatile' CP
  • Loading branch information
pgengler committed May 27, 2019
1 parent 538f0c4 commit 1f2505e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions addon/services/features.js
Expand Up @@ -74,6 +74,13 @@ const FeaturesService = Service.extend({
}
});

// Use a native getter instead of a `volatile` computed property since those
// were deprecated as of Ember 3.9. The Object.defineProperty approach (from
// https://github.com/emberjs/ember.js/issues/17709#issuecomment-469941364 is
// used because defining native getters directly on EmberObject-based classes
// is only supported from Ember 3.9 on (https://github.com/emberjs/ember.js/pull/17710)
// and this preserves compatiblity until this addon drops support for older
// Ember versions.
Object.defineProperty(FeaturesService.prototype, 'flags', {
get() {
return Object.keys(this._flags);
Expand Down

0 comments on commit 1f2505e

Please sign in to comment.