Chrome 44 Beta: Improvements to Notifications API and promoted add to homescreen
Tuesday, June 2, 2015
The newest Chrome Beta channel release includes new ES6 features and a number of updates to existing APIs. Unless otherwise noted, changes described below apply to Chrome for Android, Windows, Mac, Linux and Chrome OS.
Improved notification capabilities
Chrome 42 allowed users to opt in to receive push notifications from sites even after the page is closed. Sites may now use getNotifications to observe which of their notifications are still being displayed, and Notification.data to store a payload with a notification so they can determine which notification was clicked.
Promoted add to homescreen improvements
Since Chrome 42, users who frequently visited a high-quality web app on Android saw a banner allowing them to add the site to their home screen in one tap. In this release Chrome fires a cancellable beforeinstallprompt event before the banner is shown, allowing developers to measure user interaction with the feature. Developers are also now able to offer the banner for their native Android app.
ES6 computed property names
Until now, developers defining a JavaScript object literal needed to know the names of all of its properties before runtime. This release increase the expressiveness of the object literal syntax by providing support for ES6 computed property names, allowing developers to put an expression in brackets [], to be computed as the property name at runtime.
let propertyName = "foo";
let obj = {
[propertyName + "IsTrue"]: true,
contains: 12
};
Other updates in this release
- Chrome’s implementation of the Push API has undergone several minor breaking changes in order to keep up to date with the evolving specification.
- ES6 extended Unicode escape sequences allow developers to use the extended set of Unicode characters in JavaScript string literals, where previously characters whose escape sequences contain more than four hexadecimal values were unable to be denoted.
- This release includes a new implementation of multi-column layout by Opera engineer Morten Stenshorne, solving historic issues with incorrect column balancing.
- Developers should now use the scroll attributes of document.scrollingElement instead of document.body as the latter has several well known issues.
As always, visit chromestatus.com/features for a complete overview of Chrome’s developer features, and circle +Google Chrome Developers for more frequent updates.
Posted by Peter Beverloo, Software Engineer and Notification Newsmaker