From c8b89002f904a03cbf7bbd7a9b743ff8bfa8c921 Mon Sep 17 00:00:00 2001 From: Grant Benvenuti Date: Mon, 10 Aug 2015 09:37:38 +1000 Subject: [PATCH] Removed direct reference to screen in addScreenOrientationApi function --- www/screenorientation.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/www/screenorientation.js b/www/screenorientation.js index 64c682b..245cd63 100644 --- a/www/screenorientation.js +++ b/www/screenorientation.js @@ -45,24 +45,22 @@ screenOrientation.setOrientation = function(orientation) { console.log('setOrientation not supported on device'); }; -function addScreenOrientationApi(obj) { - if (obj.unlockOrientation || obj.lockOrientation) { +function addScreenOrientationApi(screenObject) { + if (screenObject.unlockOrientation || screenObject.lockOrientation) { return; } - obj.lockOrientation = function(orientation) { + screenObject.lockOrientation = function(orientation) { if (Orientations.indexOf(orientation) == -1) { console.log('INVALID ORIENTATION', orientation); return; } - screenOrientation.currOrientation = orientation; - screen.orientation = screenOrientation.currOrientation; + screenOrientation.currOrientation = screenObject.orientation = orientation; screenOrientation.setOrientation(orientation); }; - obj.unlockOrientation = function() { - screenOrientation.currOrientation = 'unlocked'; - screen.orientation = screenOrientation.currOrientation; + screenObject.unlockOrientation = function() { + screenOrientation.currOrientation = screenObject.orientation = 'unlocked'; screenOrientation.setOrientation('unlocked'); }; }