Google has released Chrome 44 beta: with updates including new ECMAScript 6 features and improved notification capabilities.
Announced on the Chromium Blog, the latest beta release for the OS brings computed property names, allowing expression for property names in object literals and class literals. Peter Beverloo, software engineer for Google's Chrome team, described the motivation for the changes, saying
Until now, developers defining a JavaScript object literal needed to know the names of all of its properties before runtime. This release increases the expressiveness of the object literal syntax by providing support for ES6 computed property names.
According to MDN's developer resources, support for computer property names in ES6 "allows you to put an expression in brackets [], that will be computed as the property name. This is symmetrically to the bracket notation of the property accessor syntax, which you might have used to read and set properties already. Now you can use the same syntax in object literals," as below:
// Computed property names (ES6)
var i = 0;
var a = {
["foo" + ++i]: i,
["foo" + ++i]: i,
["foo" + ++i]: i
};
console.log(a.foo1); // 1
console.log(a.foo2); // 2
console.log(a.foo3); // 3
var param = 'size';
var config = {
[param]: 12,
["mobile" + param.charAt(0).toUpperCase() + param.slice(1)]: 4
};
console.log(config); // { size: 12, mobileSize: 4 }
The beta release of Chrome 44 also welcomes notification capability improvements. In the HTML5 Rocks article Notifying you of Changes to Notifications, Matt Gaunt -- developer advocate for Google -- explains the update. Gaunt says:
"
Notification.data
allows you to associate a JavaScript object with a Notification. What this basically boils down to, is when you receive a push message, you can create a notification with some data, then in the notificationclick event you can get the notification that was clicked and get its data."
The update enables sites to use getNotifications
to observe which notifications are still being displayed after the page is closed, and Notification.data
to store a payload with a notification so that it may be determined which notification was clicked.
Also new in 44 are multi-column CSS samples and extended Unicode escape sequences. In Unicode, where previously a pair of surrogate code points needed to be used to represent Unicode code points outside of the basic multilingual plane in JavaScript string literals, the update allows for a more concise representation of code points in other planes.
For CSS styles, although Google already supports in Chrome CSS styles related to multi-column layouts, the beta release specifically includes a rewritten implementation to resolve some issues and, in Google's own words "[bring] support up to par with what other browsers offer. "
Breaking changes are introduced in the release by updates to the Push API. In particular, where the PushSubscription
object had a subscriptionId variable on it in Chrome 42, the subscriptionId
(otherwise known as the GCM registration ID), is appended to the PushSubscription.endpoint
. A warning is shown in Chrome 44, but subscriptionId is still in the PushSubscription
object.
Gaunt comments in the HTML5 Rocks article that the last common feature request from devs is "the ability to close a notification after a certain time period or the ability to send a push notification with the purpose of just closing a notification if it’s visible." Unfortunately, Gaunt says, there isn’t a way this can be done and there is nothing in the spec that would allow it -- however he says the Chrome engineering team are aware of it.