Ember 3.6 released

Today, the Ember project released version 3.6 of Ember.js, Ember Data, and Ember CLI. Highlights include public API support for ES6 classes and two new RouterService methods.

This version started the 3.7 test cycle of all sub-projects. We encourage our community (especially plugin authors) to help test these beta versions and report any bugs before they are released as the final version in six weeks.This Embers try Plugins are a great way to continuously test your project against the latest Ember version.

You can read more about our general publishing process here:


Ember.js is the core framework for building ambitious web applications.

Changes in Ember.js 3.6

Ember.js 3.6 is an incremental, backward compatible version of Ember with bug fixes, performance improvements, and a small number of deprecations. There are 2 new features, 6 deprecations and 13 bug fixes in this version.

New features (2)

Local Course (1 of 2)

This ES class with Native class constructor update RFC is officially released in 3.6! This feature means that the use of native classes has been stabilized, they are considered public APIs, and their behavior will not change.

Great so i can use class The current grammar? !

Stay calm!Is not quite It’s that simple.

The behavior of native classes is stable, but currently Ember does not support or recommend the use of class fields or decorators, they are still in the process of TC39. TC39 (Technical Committee No. 39) is part of ECMA, which standardizes the JavaScript language according to the “ECMAScript” specification. A follow-up RFC must be developed to make these formally part of Ember.

Without decorators or class fields, the benefits of class syntax are usually not worth the price. The easy-to-use behaviors and functions that we rely on daily in Ember, such as service injection, computed properties, and operations, all require decorators.Even if you don’t need any of these values, if there is no class field, you must init Hook instead, which will make it even more It is difficult to update class fields and decorators after they are released.

With this in mind, Ember officially recommends continuing to use the standard EmberObject.extend() If you can’t afford the risk, use the syntax that defines the factory. The guide will continue to use this syntax for the time being.

So what’s the point?

The behavior of the stable class provides an API that can be constructed for early adopters.For users who have stronger risk tolerance and want to become early adopters, community projects such as Embers cli typescript with Ember decorator The transformations and decorators needed to use class syntax today are being provided, and we are committed to maintaining stability and providing an update path through any changes that occur in TC39 when the proposal is finalized.

Early adopters have been helping to sort out the details here and make sure that on the day the proposal is made, we are ready to get official support directly in Ember.Early adoption do There are risks, so if you are thinking about it, be prepared to have to make changes in the future.

For users who are not ready to adopt, it doesn’t matter-the EmberObject model will continue to be supported for some time to come.In addition, work is progressing Code module This will seamlessly convert the old class model to the new class model, helping to migrate from day one.

Instructions for use

The native class has some notable changes and features:

  • new The extended class does not currently support the syntax EmberObject. You must continue to use create Methods when creating new instances of the class, even if they are defined using native class syntax.If you want to use new Syntax, consider creating such a class Is not Extends from EmberObjectEmber features, such as calculated attributes and decorators, still apply to baseless classes.
  • Instead of using this._super(), You must use the standard super syntax.see MDN documentation on classes more details.
  • Native class support Constructor Set up the newly created instance. Ember uses these to support functions that need to retrieve other entities by name, such as service injection and getOwner. To ensure that your custom instance setup logic occurs after this important work is completed, please avoid using constructor beneficial to init.
  • Full support for using native classes and switching back to the old Ember object model.
  • For early adopters who are accustomed to parameter values ​​and the values ​​passed to create Is covered, this is no longer the case! The class field value will be the default value, and any value passed to the class at creation time will override that value.
Compatibility and Polyfill

A polyfill has been built for this behavior, which will be backported to Ember 3.4 and 3.5.you can see Here, Or use ember-cli to install it:

ember install ember-native-class-polyfill

We also want to add support for previous LTS versions (2.18 and 2.16), so if you want to contribute, please go to the #st-native-classes channel on Discord or Native Class Quest problem On Github!

The final stage of the router service RFC (2 of 2)

Ember 3.6 introduced the final stage of the router service RFC. This version includes two new methods: recognize(url) Can return a RouteInfo According to the URL you pass and recognizeAndLoad(url) It accepts a string URL and returns an parsed as RouteInfoWithAttributes Used for the leafmost route represented by the URL. If the URL cannot be recognized or an unhandled exception is encountered, the promise will be rejected.

The final stage also introduces new observable properties currentRouteAs long as a route transition occurs (even if the transition only changes the parameters and not the active route), it can guarantee the change. You should consider that its value is immutable-as long as it changes, we will replace the entire structure.the value of currentRoute Is an RouteInfo Represents the current leaf route.

At the end of the final phase, we introduced two new events to the router service: routeWillChange with routeDidChange. They all received one transition Parameters that have been expanded to include now to with from characteristic. This allows you to understand the location and direction of the transition.To see some examples of this, be sure to read Active part RFC.Must see RFC itself More information about router services.

Deprecated (6)

When the API will be removed in the future, a deprecation will be added to Ember.js. Each deprecation guide has an entry in the deprecation guide that describes the migration path to a more stable API. Before the major version of the framework is released, the deprecated public API will not be removed.

Consider using ember-cli-deprecated-workflow addon If you want to upgrade your application without immediately solving the deprecation issue.

For more details about the changes in Ember.js 3.6, please check Ember.js 3.6 release page.

New EmberObject (1 of 6)

We do not approve of using new EmberObject() Construction instance EmberObject And its subcategories.This affects all classes extended from EmberObject It also includes user-defined classes and Ember classes, such as:

  • Component
  • Controller
  • Service
  • Route
  • Model

Instead, you should use EmberObject.create() Create a new instance of the class that extends from EmberObject. If you use native class syntax instead of EmberObject.extend() To define your class, you can also refactor as Is not Extends from EmberObjectAnd continue to use new syntax.

To read more about this deprecation and how to refactor existing code, check out Deprecated pages.

Remove all listeners/observers (2 of 6)

When used at the same time removeListener with removeObserver Method, the user can omit the last string or method parameter to trigger an undocumented code path, which will be deleted All The event listener/observer for the given key. This feature will be removed because it is infrequently used, undocumented, and adds considerable complexity to the critical path.

To read more about this deprecation and how to refactor existing code, check out Deprecated pages.

Deprecated Ember.merge (3 out of 6)

since Ember.assign released, Ember.merge It becomes almost unnecessary.To reduce duplication, we now recommend using Ember.assign instead Ember.merge.

If you need to support Ember <=2.4 you can use Embers allocation polyfill Make Ember.assign Available for you to use.

View the code example of the switch from Ember.merge to Ember.assign Please refer to Deprecated apps.

HandlerInfos delete (4, 6 in total)

because Router Service RFC It is necessary to rename the private API HandlerInfo to RouteInfo.

If you need to access information about routing, you are most likely to get better service by injecting router services, because it exposes a publicly supported version RouteInfos.For help on how to do this, see Deprecated apps.

Deprecated router events (5 of 6)

Currently, application-wide conversion monitoring is distributed throughout Route class.This doesn’t really belong here, it’s in Router Service instead.

This is the existing reason willTransition with didTransition Hooks/events on the router. But they are not enough to capture all the details people need.

In addition, they also received handlerInfos Among their parameters, this is an undocumented internal implementation detail of router.js, which is not part of Ember’s public API.Everything you can do with handlerInfos can be used RouteInfo.

An example of how to convert the two Route with Router Usage willTransition with didTransition, Please refer to Deprecated apps.

Transition state removal (6 out of 6)

This Transition object is a public interface, which actually exposes the internal state that router.js uses to perform routing.

access state, queryParams or params in Transition Has been deleted.If you need to access information about routing, you might be better off injecting the router service because it exposes a publicly supported version RouteInfos.

For information on how to do this, see Deprecated apps.

Embers data

Ember Data is the official data persistence library for Ember.js applications.

Changes in Ember Data 3.6

New features (0)

No new features have been introduced in Ember Data 3.6.

Deprecated (0)

No new deprecations have been introduced in Ember Data 3.6.

For more details about the changes in Ember Data 3.6, please check
Ember Data 3.6 release page.

Ember command line interface

Ember CLI is a command line interface for managing and packaging Ember.js applications.

Upgrade Ember CLI

You can upgrade Ember CLI separately from Ember.js and Ember Data! Use the following command to upgrade your global Ember CLI yarn Run:

yarn global upgrade ember-cli

Use the following command to upgrade your global Ember CLI npm Run:

npm install -g ember-cli

To update your project, you need to run the following steps:

  1. rm -rf node_modules dist tmp – Delete the temporary development folder.
  2. npm install -g ember-cli-update – Install the Ember CLI update tool globally.
  3. Run ember-cli-update – This will update your application or plugin to the latest ember-cli version. You may encounter merge conflicts that should be resolved in the normal git workflow.
  4. Run ember-cli-update --run-codemods – This will allow you to choose codemods to run against your project to ensure that you use the latest modes and platform features.

Changes in Ember CLI 3.6

New features (1)

Prevent double construction in CI (1 of 1)
Before version 3.6, plugin authors (unless the plugin is in an organization) always ended up with two CI builds per PR. One is for branch push, and the other is for PR update. It is now fixed in Ember CLI 3.6 (for TravisCI users).

Deprecated (0)

This version is not deprecated.

For more details about the changes in Ember CLI 3.6 and detailed upgrade instructions, please check Ember CLI 3.6.0 release page.

thank you!

As an ambitious community-driven open source project, each of these releases reminds us that without your continued support, the Ember project is impossible to achieve. We are very grateful for the efforts of our contributors.

Leave a Reply

Your email address will not be published. Required fields are marked *