diff options
author | Jukka Jylänki <jujjyl@gmail.com> | 2014-02-01 00:01:36 +0200 |
---|---|---|
committer | Jukka Jylänki <jujjyl@gmail.com> | 2014-02-01 00:02:18 +0200 |
commit | 506dcd83d67ad722ba63bb31762b01898807d99c (patch) | |
tree | d303c8b52395944fc717edd57a4ed74e249749ab /src | |
parent | f70fd0ef85f5c7383db9cbc1658c0bc6752d75a8 (diff) |
Add support for detecting whether screen orientation lock succeeds or fails. Current testing suggests that Firefox Nightly on Android does not support orientation lock. See https://bugzilla.mozilla.org/show_bug.cgi?id=966480 .
Diffstat (limited to 'src')
-rw-r--r-- | src/library_html5.js | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/library_html5.js b/src/library_html5.js index 703f9a74..f9b8a8c7 100644 --- a/src/library_html5.js +++ b/src/library_html5.js @@ -980,18 +980,23 @@ var LibraryJSEvents = { if (allowedOrientations & 2) orientations.push("portrait-secondary"); if (allowedOrientations & 4) orientations.push("landscape-primary"); if (allowedOrientations & 8) orientations.push("landscape-secondary"); + var succeeded; if (window.screen.lockOrientation) { - window.screen.lockOrientation(orientations); + succeeded = window.screen.lockOrientation(orientations); } else if (window.screen.mozLockOrientation) { - window.screen.mozLockOrientation(orientations); + succeeded = window.screen.mozLockOrientation(orientations); } else if (window.screen.webkitLockOrientation) { - window.screen.webkitLockOrientation(orientations); + succeeded = window.screen.webkitLockOrientation(orientations); } else if (window.screen.msLockOrientation) { - window.screen.msLockOrientation(orientations); + succeeded = window.screen.msLockOrientation(orientations); } else { return {{{ cDefine('EMSCRIPTEN_RESULT_NOT_SUPPORTED') }}}; } - return {{{ cDefine('EMSCRIPTEN_RESULT_SUCCESS') }}}; + if (succeeded) { + return {{{ cDefine('EMSCRIPTEN_RESULT_SUCCESS') }}}; + } else { + return {{{ cDefine('EMSCRIPTEN_RESULT_FAILED') }}}; + } }, emscripten_unlock_orientation: function() { |