Chrome 74 has been released. The most notable user facing feature is dark mode. It has a number of API updates for developers too. Some of those updates include the following (but there are more)
-
- Private class Fields
- Reduced Motion Experience
- CSS Transition Event
- Feature Policies
- KV Storeage API
- Buffering of
client.postMessage()
Private Class Fields
Fields on classes can now be declared as private by prefixing them with #. Consider the # to be part of the members name. Members marked with this character are not accessible outside of the class.
Reduced Motion Experience
There are people that might experience motion sickness from web pages with lots of scrolling and parallax. A new media query was added so that an experience with less motion can be provided to users that are sensitive to it.
@media(prefers-reduced-motion:reduce)
CSS Transition Event
Other browsers have supported CSS transition events. Until now Chrome hasn’t been one of them. With the release of Chrome 74 transition events are now supported. The names of the events are
transitionrun
transitionstart
transitionended
transitioncancel
Feature Policies
Some APIs can be selectively enabled or disabled through a Feature-Policy header or through an allow attribute on an iframe
. The list of features allowed can be queried with document.featurePolicy.allowedFeatures()
KV Storage API
Storage through localStorage is slow (it’s synchronous). While IndexedDB is asynchronous it’s a more complex API. To provide a faster API that is easier to use Google has added support for the Key Values Storage API. There is also a KV polyfill for browsers that do not support KV Storage.
Buffering of client.postMessage()
Messages sent via client.postMessage()
are now buffered until a document is ready. a call to postMessage
doesn’t dispatch until either DOMContentLoaded
is fired, onmessage
is set, or startMessages()
is called.