mirror of
https://github.com/apache/cordova-plugin-screen-orientation.git
synced 2025-02-23 16:42:50 +08:00
Removed direct reference to screen in addScreenOrientationApi function
This commit is contained in:
parent
1195b40612
commit
c8b89002f9
@ -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');
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user