Skip to content
This repository has been archived by the owner on Mar 22, 2019. It is now read-only.

Commit

Permalink
Merge pull request #2573 from robbiepitts/deprecate-ember-binding
Browse files Browse the repository at this point in the history
Deprecate Ember.Binding
  • Loading branch information
mmun committed May 3, 2016
2 parents 4bfda26 + 91619e9 commit 6e6becd
Showing 1 changed file with 61 additions and 0 deletions.
61 changes: 61 additions & 0 deletions source/deprecations/v2.x.html.md
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,67 @@ Once view and controller deprecations are removed, you can remove the addons wit
`Ember.Backburner` was private throughout the Ember 2.x series and will be
removed _after_ 2.8.
#### Ember.Binding
##### until: 3.0.0
##### id: ember-metal.binding
`Ember.Binding` has not been needed for some time and is deprecated in favor of
computed properties and services (depending on what you were binding to). It is
recommended that you take the following actions:
1. Refactor global bindings to services
2. Refactor `oneWay` bindings to `readOnly` computed properties
3. Refactor all other bindings to `alias` computed properties
The [guide on services]
(https://guides.emberjs.com/v2.5.0/applications/services/) is a good place
to start for creating and consuming services to replace your global bindings.
In general though, you will replace your global with a service and consume it
like this:
```js
export default Ember.Component.extend({
// will load the service in file /app/services/cool-service.js
coolService: Ember.inject.service()
});
```
This would replace a binding that may have looked like this:
```js
export default Ember.Component.extend({
boringObjectBinding: 'MyApp.boringObject'
});
```
Refactoring local bindings to computed properties can be achieved with
less work:
If you had this:
```js
export default Ember.Component.extend({
thingContainer: …,
thingOneBinding: Ember.Binding.oneWay('thingContainer.thingOne'),
thingTwoBinding: 'thingContainer.thingTwo'
});
```
You could change it to this:
```js
export default Ember.Component.extend({
thingContainer: …,
thingOne: Ember.computed.readOnly('thingContainer.thingOne'),
thingTwo: Ember.computed.alias('thingContainer.thingTwo')
});
```
See the [guide on computed properties]
(https://guides.emberjs.com/v2.5.0/object-model/computed-properties/) for
further reading.
### Deprecations Added in Pending Features
#### Route#serialize
Expand Down

0 comments on commit 6e6becd

Please sign in to comment.