The Ember.js team has released the stable version of Ember 2.3, and the first beta of 2.4.
Announcing the changes on the Ember blog, Ember contributor Matthew Beale modestly describes the update as a "minor release." Nonetheless, 2.3 comes with several significant changes, including the ability to use Ember FastBoot with the latest stable release.
An Ember CLI addon, Fastboot allows developers to render and serve Ember.js apps on the server, serving rendered HTML to browsers without the need for the clients to download JavaScript assets. With new testing APIs and Fastboot, the Ember team has added a visit
method for Ember.Application
and Ember.ApplicationInstance
objects.
As Fastboot is oficially still experimental, 2.3 is the first time that it can be used with an Ember release build. It should be noted that among Fastboot's few limitations, it does not support most of jQuery, and the team advises "only the most brave should even consider deploying this to production."
Another new feature in Ember's latest stable release is the introduction of contextual components, that allow multiple components to privately share data, but be invoked in a flexible manner. In the example below shared by Beale on the Ember blog, an {{alert-box}}
component yields a contextual component composed of the alert-box-button
component and the attribute onclick.
According to Beale "Contextual components are created using the nested form of the component
helper, and may be passed attrs and positional params. Contextual components must be invoked with a .
in their path, unless they are being passed to the invoking {{component
helper."
{{! app/templates/components/alert-box.hbs }}
<div class="alert-box">
{{yield (hash
close-button=(component 'alert-box-button' onclick=(action 'close'))
)}}
</div>
{{! app/templates/index.hbs }}
{{#alert-box as |box|}}
Danger, Will Robinson!
<div style="float:right">
{{#box.close-button}}
It's just a plain old meteorite.
{{/box.close-button}}
</div>
{{/alert-box}}
"
This new feature is a powerful tool for addon authors, allowing them to yield components without having arguments to those components become de-facto public API," Beale said.
Still in Beta, Ember 2.4 is promising the community performance improvements over new framework features. Users should refer to the Ember 2.3 and 2.4 changelogs for full info on the releases.
Ember.js is released via an MIT licence. InfoQ readers can contribute to Ember.js via its GitHub project.