From f8c75e341ae521cd248e9385e6b05bdd3344274d Mon Sep 17 00:00:00 2001 From: maverickmishra Date: Mon, 9 Jan 2017 17:10:07 -0800 Subject: [PATCH] improved the orientation change method --- www/screenorientation.js | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/www/screenorientation.js b/www/screenorientation.js index bf0f1e8..891c3bc 100644 --- a/www/screenorientation.js +++ b/www/screenorientation.js @@ -94,22 +94,8 @@ orientationChange(); function orientationChange() { - switch (window.orientation) { - case 0: - screen.orientation.type = window.OrientationType['0']; //append angle here ? - break; - case 90: - screen.orientation.type = window.OrientationType['90']; - break; - case 180: - screen.orientation.type = window.OrientationType['180']; - break; - case -90: - screen.orientation.type = window.OrientationType['-90']; - break; - default: - screen.orientation.type = window.OrientationType['0']; - } + screen.orientation.type = window.OrientationType[window.orientation]; + } window.addEventListener("orientationchange", orientationChange, true); module.exports = screenOrientation; \ No newline at end of file