Ruth John: Web APIs

Orde Saunders' avatarPublished: by Orde Saunders

Ruth John was talking about Web APIs at Responsive Conf, these are my notes from her talk.

We talk about web APIs a lot but what are they?  They're mostly used in the browser, but some of them work outside the browser, and some work with device features.  Client Side Web APIs (CSWAPIS).  Started with "HTML5" and native influence.

Geolocation API - gives you a latitude and longitude.  Has a watcher so we can update the locations as we move - can create a sat nav in the browser using Google Maps.  Browser support is good as this API has been around for some time.

["I'm on the WiFi so these demos are going to be slow."]

Web animation API - this is CSS in JS.  Much easier then trying to control CSS animations using JS, gives us a timing layer on top of the visuals that come from CSS.  Animations are event based so should live in JS.  Based on CSS transitions, CSS animations, SVG animations.  The API gives a lot of control - check the specks.  Support isn't great as this is still new.

Web audio API - use the browser to work with sound.  Nodes - input, modification, analyser and output.  Pipe data through API methods.  Support is mixed - start using it as an enhancement.

Ambient light API - uses the camera.  Triggers a JS event when the lux changes.  Support is limited, good in FF but behind flags in chrome.  Can use it to change the contrast of a design when the light changes.

There are lots more:

  • Media screen
  • Device orientation
  • Screen orientation
  • Proximity
  • Push notifications
  • Network information (not speed)
  • File system
  • Web speech
  • Full screen
  • Notifications
  • Gamepad
  • Alarm
  • Pointer lock
  • Encryption
  • ...