Ember 1.0 RC4
Announcement
We have noticed a performance regression, a debug flag was left on by mistake. So if you really want the goodness of RC4 without this regression use this build, we'll have an official release out soon.
Today, we are pleased to announce Ember.js 1.0 RC4:
This RC4 release of Ember puts us very close to the final 1.0 release.
Ember.js 1.0 RC4
As we approach 1.0 final, our focus continues to be on bugfixes, performance, and reliability.
BREAKING CHANGE: Controller/Model Setup
One of the roles of Route
objects in an Ember application is to tell
controllers which model they should represent.
By default, the object that you return from a route's model
hook is
set as the model
property on the corresponding controller. So, for
example, if you have this route:
App.PhotosRoute = Ember.Route.extend({
model: function() {
return App.Photo.find();
}
});
The array returned from model
would be set as the model
property of
the App.PhotosController
. This tells the controller that it should
present that model to its template.
What if you need to set up additional controllers, beyond the primary
controller associated with that route? In that case, you can implement
the setupController
hook:
App.PhotosRoute = Ember.Route.extend({
model: function() {
return App.Photo.find();
},
setupController: function(controller, model) {
this.controllerFor('application').set('showingPhotos', true);
}
});
This is all well and good, but what if you wanted to prevent a model
from being set on the PhotosController
at all?
In RC3, preventing this default behavior was impossible. In RC4,
implementing the setupController
hook prevents the default behavior
from happening. This is a potentially breaking change.
If your route implements the setupController
hook and you want to
preserve default behavior, make sure you call _super()
from within
the hook:
App.PhotosRoute = Ember.Route.extend({
model: function() {
return App.Photo.find();
},
setupController: function(controller, model) {
// Call _super for default behavior
this._super(controller, model);
this.controllerFor('application').set('showingPhotos', true);
}
});
Thanks to Kris Selden and Luke Melia for pulling together PRs from Paul Chavard, Rob Harper and input from others into a cohesive change. We don't take breaking changes lightly at this stage of the release process, but this one is worthwhile.
RSVP 2.0
Ember now embeds version 2.0 of RSVP.js, a microlibrary for Promises/A+ compatible promises.
All of the Ember.js APIs that return promises use this library to ensure compatible behavior.
A big, big thanks to Stefan Penner for all of his work on improving the promises story across both Ember and Ember Data.
Run Loop Extracted to Backburner.js
Erik Bryn has extracted the run loop into the Backburner.js microlibrary, which Ember now uses.
This will allow other frameworks and libraries that use Backburner to benefit from using a deferred event queue, and hopefully we can share our work to make the web platform faster for everyone.
Handlebars RC4 Compatibility
Ember.js RC4 requires the latest release of Handlebars, which is also at RC4.
Improved Route Redirection
Routes provide a redirect
hook that allow them to conditionally redirect to
a different route. For example, you may redirect the user to a login
route if you detect that they do not have an authentication token saved.
Many improvements to the redirect
hook have been made to make it more
reliable. Additionally, you can now implement this hook in the
ApplicationRoute
, which previously would not work.
Props to Tom Dale for this work.
ember-testing Improvements
The ember-testing
package, included in Ember.js, is the
officially-supported library for writing unit and integration tests for
Ember apps. Introduced in RC3, this has continued to be improved, with
many bug fixes and performance improvements landing in RC4.
A huge thanks to Teddy Zeeny for driving many of these improvements.
disabledWhen
{{linkTo}} Option
The {{#linkTo}}
Handlebars helper now has a disabledWhen
option that
can be bound to conditionally disable a link:
Upgrade Account
Thanks to Trek Glowacki for this improvement.