Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify use of private API for deprecation solution #157

Closed
jenweber opened this issue Jul 5, 2018 · 2 comments
Closed

Clarify use of private API for deprecation solution #157

jenweber opened this issue Jul 5, 2018 · 2 comments

Comments

@jenweber
Copy link
Contributor

jenweber commented Jul 5, 2018

defineProperty is private API, but we suggest it as a way to resolve a deprecation. We should give more guidance for alternatives:

Edward Faulkner’s comments from Slack:

it depends why they’re using it.

  • If they’re trying to use it as a polyfill for the native Object.defineProperty, they should just use that directly. Every browser Ember supports has that, and Ember itself depends on it.
  • If they’re trying to make computed properties on a plain old Javascript object, they should not do that. They should either make the object an Ember.Object and declare computed properties in the normal way, or they should keep the object as a POJO and use Object.defineProperty to make a native getter.
  • If they’re creating computed properties and can’t do it the normal way because they don’t know what the dependent keys are until after construction, they should do their own dependency observation with addObserver and notifyPropertyChange. This is an advanced thing to be doing, more likely in an addon that’s trying to present a whole new API on top of Ember than in an app.
@kennethlarsen
Copy link
Member

@jenweber It looks like it is now marked as public instead (emberjs/ember.js#17028) - should we close this issue?

@jenweber
Copy link
Contributor Author

jenweber commented Jul 7, 2019

Agreed, closed. Thanks!

@jenweber jenweber closed this as completed Jul 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants