Useful decorators for Ember applications.
@classNameBindings
and @attributeBindings
class decorators, which make 1-1 conversions for components that use these APIs much easierRemoved Packages
@ember-decorators/babel-transforms
@ember-decorators/controller
@ember-decorators/data
@ember-decorators/service
Removed APIs from @ember-decorators/object
@computed
@wrapComputed
@action
The functionality provided by these APIs is now built into Ember directly! You will be able to use them by importing them from ember
, e.g.
import { action, computed } from '@ember/object';
You can include these in your app today using the polyfill.
@readOnly
and @volatile
have been removed in favor of @(computed().readOnly())
and @(computed().volatile())
style declarations. All classic modifiers are available, enabled, and chainable in this way.@reads
and @overridableReads
have been removed and changed back to @readOnly
and @reads
respectively, and @oneWay
has been added back.@service
and @controller
have both been renamed to inject
to match the exports in Ember proper.shouldThrowOnComputedOverride
configuration option has been removed, since it is not an option in Ember proper.macro
function in favor of compatibility with classic classes@computed
can now receive a ComputedPropertyDescriptor as its last argument (e.g. a function or { get, set }
object.@ember/object#computed
.@action
now binds action methods as well as copying their reference.@readOnly
computed macro has been renamed to @reads
, and the @reads
and @oneWay
macros have been renamed to @overridableReads
throwOnComputedOverride
option in the build config.@readOnly
and added @volatile
@readOnly
and @volatile
can be applied in any orderv2.0.0 is a major refactor that pushes all of the individual packages from Ember Decorators out into individual packages. The core addon is still around, but it's now a shell addon that includes the others.
Imports should now be from the scoped packages instead of the main addon:
// before
import { computed } from 'ember-decorators/object';
// after
import { computed } from '@ember-decorators/object';
@attribute
and @className
no longer place the value of class fields on the prototype of the class. If you want to set defaults, you'll need to use an initializer:
// before
@className foo = 'bar';
// after
@className foo = this.foo || 'bar';
Support for decorating plain functions using @computed
has been removed. You must now decorate native getters and setters:
// before
@computed
foo() {
return 'bar';
}
// after
@computed
get foo() {
return 'bar';
}