Skip to content

Commit

Permalink
Replace screen with window.screen to stop exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
cwoffenden committed Mar 7, 2024
1 parent ae17e0b commit 65f0eee
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/library_html5.js
Original file line number Diff line number Diff line change
Expand Up @@ -929,7 +929,7 @@ var LibraryHTML5 = {
},

$screenOrientation: () => {
if (!screen) return undefined;
if (!window.screen) return undefined;
return screen.orientation || screen['mozOrientation'] || screen['webkitOrientation'];
},

Expand Down Expand Up @@ -999,7 +999,7 @@ var LibraryHTML5 = {
emscripten_set_orientationchange_callback_on_thread__proxy: 'sync',
emscripten_set_orientationchange_callback_on_thread__deps: ['$registerOrientationChangeEventCallback'],
emscripten_set_orientationchange_callback_on_thread: (userData, useCapture, callbackfunc, targetThread) => {
if (!screen || !screen.orientation) return {{{ cDefs.EMSCRIPTEN_RESULT_NOT_SUPPORTED }}};
if (!window.screen || !screen.orientation) return {{{ cDefs.EMSCRIPTEN_RESULT_NOT_SUPPORTED }}};
return registerOrientationChangeEventCallback(screen.orientation, userData, useCapture, callbackfunc, {{{ cDefs.EMSCRIPTEN_EVENT_ORIENTATIONCHANGE }}}, 'change', targetThread);
},

Expand Down

0 comments on commit 65f0eee

Please sign in to comment.