Last active
August 29, 2015 14:08
-
-
Save simevidas/70caf9e7196dbb6f07c2 to your computer and use it in GitHub Desktop.
A comparison of the new vs old Screen Orientation API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.