Flurin Egger: Taming the browsers of tomorrow
Flurin Egger (@flurin) was speaking at Side View about the future of web browsers, these are my notes from his talk.
Browsers are getting smarter and more aware of their surroundings.
Promises (natively)
A promise represents the eventual result of an async operation. These are like events or callbacks but are resolved asynchronously, they lead to more readable code than callback hell. Can also handle multiple results without needing a global state var to manage them. There are some versions of this in libraries but they are coming natively - already in FF, Safari and Chrome.
Ambient light events
Gives access to the device's ambient light sensor via an event when it changes. Event is devicelight
and event.value
is the lux value of the new ambient light. Currently working in FF 22 including on Android.
Vibration API
navigator.vibrate(milliseconds)
- simple. milliseconds argument can be int or array of ints.
Web speech API
Text to speech. Create a new SpeechSynthesisUtterance('string')
- can specify different attributes and then call .speak()
.
Speech recognition - this needs an internet connection. window.webkitSpeechRecognition()
Screen sharing
getUserMedia + WebRTC can be used to share the screen.
Service workers
Allow us to persistently cache resources and handle requests to these resources, even when the network isn't available. This allows us to build better offline apps. There is a shared worker that lives across page loads and an HTTP cache. Not available anywhere right now - just a specification. Firefox are looking into implementing this.
More
- Mini API
- Battery Status API
- Web Crypto API
- URL object
We need to use these things and feed back to browser vendors to help them make them better.