Skip to content

Instantly share code, notes, and snippets.

@simevidas
Last active August 29, 2015 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save simevidas/70caf9e7196dbb6f07c2 to your computer and use it in GitHub Desktop.
Save simevidas/70caf9e7196dbb6f07c2 to your computer and use it in GitHub Desktop.
A comparison of the new vs old Screen Orientation API
// Old API
screen.orientation
.lockOrientation( orientations )
.unlockOrientation()
screen.addEventListener('orientationchange', handler)
// New API
screen.orientation.type
.angle
.onchange
.lock( lockType ) // returns Promise
.unlock()
screen.orientation.addEventListener('change', handler)
@simevidas
Copy link
Author

Old API (February 2014 draft): http://www.w3.org/TR/2014/WD-screen-orientation-20140220/
New API (October 2014 draft): http://www.w3.org/TR/2014/WD-screen-orientation-20141023/

The new API has already been implemented and enabled by default in Chrome and Opera.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment