In Chrome 75, we've added support for:
- There's a new way to reduce latency on
canvas
elements. - Web apps can now share files to other installed apps using the system level share sheet.
- Numeric literals now allow underscores as separators to make them more readable.
- Google I/O 2019 is a wrap and all of talks are on our YouTube channel.
I'm Pete LePage, let's dive in and see what's new for developers in Chrome 75!
Change log
This covers only some of the key highlights, check the links below for additional changes in Chrome 75.
- What's new in Chrome DevTools (75)
- Chrome 75 deprecations & removals
- ChromeStatus.com updates for Chrome 75
- What's new in JavaScript in Chrome 75
- Chromium source repository change list
Hint for low latency canvas
contexts
Drawing on screen with the canvas element requires the page to synchronize graphics updates with the DOM. This synchronization can sometimes cause latency. For example, in a drawing app, latencies longer than 50 milliseconds can interfere with hand-eye coordination, making them difficult to use.
The desynchronized
hint, when creating a canvas
context, uses a different
code path, that bypasses the usual DOM update mechanism. The hint tells the
system to skip as much compositing as it can. In some cases, the canvas
's
underlying buffer is sent directly to the screen's display controller. This
eliminates the latency that would be caused by using the renderer compositor
queue.
Using the desynchronized hint is simple, just add desynchronized: true
to
the options object when creating the canvas.
const opts = { desynchronized: true };
const ctx = canvas.getContext('2d', opts);
Check out Joe's article Low-latency rendering with the desynchronized hint for more details, including how to do feature detection for it.
Share files with the Web Share API
The Web Share API allows you to plug into the share service provided by the OS, making it easy to share web pages and apps with other installed apps on the user's device.
In Chrome 75, the Web Share API now supports the sharing of files! I'm particularly excited about this because it makes it way easier for apps to share photos, videos and more. Squoosh is adding support for this to share a file once you've finished compressing it. The Web Share API currently supports the sharing of audio files, images, videos, and text documents.
It's best to use feature detection to see if the Web Share API is supported,
and fallback to your traditional mechanism if it's not. And you can use
navigator.canShare
to check if file sharing is supported.
const webShareAvailable = {
links: 'share' in navigator,
files: 'canShare' in navigator,
};
If navigator.canShare
returns true
, sharing of those files is supported,
so you can call navigator.share
, and pass an object with the array of files
you want to share. Chrome will open the system share sheet and give you a
list of installed apps that you can share the files to.
if (webShareAvailable.files) {
const shareData = { files: filesArray };
if (navigator.canShare(shareData)) {
shareData.title = 'Squooshed files.';
navigator.share(shareData)
.then(...)
.catch(...);
} else {
// File sharing not supported
}
}
Try the demo and check out the article Share files with Web Share for complete details.
Numeric separators
Numeric literals now allow underscores (_, U+005F) as
separators to make them more readable. For example, 1_000_000_000
will be
interpreted by mathematical operations as equivalent to 1000000000
.
Underscores can only appear between digits, and consecutive underscores are
not allowed. So literals such as 3._14
, _2.71
or 1.6__2
are illegal.
Google I/O 2019 is a wrap
If you didn't make it to I/O, or maybe you did, and didn't see all the talks, they're all up on the Chrome Developers YouTube channel, in the Web at Google I/O 2019 playlist.
- Tom and I presented "Unlocking new capabilities for the web" covering some of the amazing new capabilities that are landing in browsers this year.
- Addy and Katie covered some cool performance tips and tricks in "Speed at Scale".
- Elizabeth and Paul dove into some cool devtools in "Demystifying Speed Tooling".
- And in "Build Fast and Smooth Web Apps from Feature Phone to Desktop" Mariko showed us how she and her crew built Proxx to work on any device, from feature phone to smart phone to desktop. If you haven't tried Proxx yet, it's a super fun mine sweeper clone.
Subscribe
Want to stay up to date with our videos, then subscribe to our Chrome Developers YouTube channel, and you'll get an email notification whenever we launch a new video.
I'm Pete LePage, and as soon as Chrome 76 is released, I'll be right here to tell you -- what's new in Chrome!
Photo Credits
- Sketching photo by Balázs Kétyi from Unsplash