- Start Date: 2018-05-01
- RFC PR: (leave this empty)
- Ember Issue: (leave this empty)
Ember.Evented
functionality on DS.Model
, DS.ManyArray
,
DS.Errors
, DS.RecordArray
, and DS.PromiseManyArray
will be
deprecated and eventually removed in a future release. This includes
the following methods from the
Ember.Evented
class: has
, off
, on
, one
, and trigger
. Additionally the
following lifecycle methods on DS.Model
will also be deprecated:
becameError
, becameInvalid
, didCreate
, didDelete
, didLoad
,
didUpdate
, ready
, rolledBack
.
The use of Ember.Evented
is mostly a legacy from the pre 1.0 days of
Ember Data when events were a core part of the Ember Data programming
model. Today there are better ways to do everything that once needed
events. Removing the usage of the Ember.Evented
mixin will make it
easier for Ember Data to eventually transition to using native ES2015
JavaScript classes and will reduce the surface area of APIs that Ember
Data must support in the long term.
Ember.Evented
mixin will be scheduled to be removed from the
following classes after the next LTS release: DS.Model
,
DS.ManyArray
, DS.Errors
, DS.RecordArray
, and
DS.PromiseManyArray
.
The has
, off
, on
, one
, and trigger
methods will be trigger a
deprecation warning when called and will be completly removed in Ember
Data 3.5 (the release following the 3.4 LTS release).
A special deprecation will be logged when users of a
DS.adapterPopulatedRecordArray
attempt to listen to the didLoad
event. This depecations will prompt users to use a computed property
instead of the didLoad
event.
DS.Model
will also recieve deprecation warnings when a model is
defined with the following methods: becameError
, becameInvalid
,
didCreate
, didDelete
, didLoad
, didUpdate
, ready
,
rolledBack
.
When a model is instantiated for the first time with any of these methods a deprecation warning will be logged notifiying the user that this method will be deprecated and the user should use an computed or overide the model's init method instead.
Today we do not teach the use of any of the Ember Data lifecycle events in the guides. They are referenced in the API docs but they will be updated to mark the APIs as deprecated and show alternative examples of how to achieve the same functionality using a non event pattern.
The drawback to making this change is existing code that takes advantage of the Ember Data lifecycle events will need to be updated to use a different pattern.
We could leave the Ember.Evented
mixin on all of the Ember Data
objects that currently support it and continue to support this
interface for the foreseeable future. However, Ember Data itself
doesn't require these events internally. There is only one place in
the DS.Error
code that takes advantage of the Ember.Evented
system
and that code can be easilly re-written to avoid Ember.Evented
APIs.
None