Opera 19 released

Hot on the heels of last week’s Opera 19 for Android release, Opera 19 for Mac and Windows (based on Chromium 32) is out! Here’s what that means for web developers.

JavaScript Promises

JavaScript Promises are now enabled by default. Promises provide a convenient way to get access to the result of an operation in JavaScript, regardless of whether that operation is synchronous or asynchronous. Here’s a silly example that demonstrates the main functionality:

var promise = new Promise(function(resolve) {
	setTimeout(function() {
		resolve('The time machine worked!');
	}, 2014); // see what I did there?
});

promise.then(function(result) {
	console.log('Promise resolved.', result);
});

Jake Archibald has written an in-depth article on JavaScript Promises, so check that out if you’re looking for more info or examples.

Animated WebP images

The animated WebP image format is an alternative to animated GIF that offers higher image quality at smaller file sizes. Opera 19 enables support for animated WebP.

Your browser supports animated WebP images.

High-performance opaque 2D context for <canvas>

Whenever you use <canvas>, and you only use non-alpha-modifying canvas commands, Opera can now optimize the blending and culling of obscured elements when compositing the canvas into the page.

To enable this behavior, pass in an object as the second parameter to the canvas element’s getContext method, setting the alpha property to false (rather than true, which is the implied default):

var context = document.querySelector('canvas').getContext('2d', {
	'alpha': false
});

More extension APIs

Opera 19 for Desktop adds the following APIs to extensions:

See our Opera 15+ extensions documentation for in-depth discussion of these APIs.

If you’re interested in experimenting with features that are in the pipeline for future versions of Opera, we recommend following our Opera Developer stream.