mirror of
https://github.com/apache/cordova-plugin-screen-orientation.git
synced 2026-05-31 00:00:04 +08:00
chore(lint): update @cordova/eslint-config and variables
This commit is contained in:
Generated
+1457
-1667
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -31,7 +31,7 @@
|
||||
"author": "Apache Software Foundation",
|
||||
"license": "Apache-2.0",
|
||||
"devDependencies": {
|
||||
"@cordova/eslint-config": "^3.0.0"
|
||||
"@cordova/eslint-config": "^5.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"cordovaDependencies": {
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
|
||||
/* global Windows, WinJS */
|
||||
|
||||
var DisplayInfo = Windows.Graphics.Display.DisplayInformation;
|
||||
var Orientations = Windows.Graphics.Display.DisplayOrientations;
|
||||
const DisplayInfo = Windows.Graphics.Display.DisplayInformation;
|
||||
const Orientations = Windows.Graphics.Display.DisplayOrientations;
|
||||
|
||||
if (!window.Promise) {
|
||||
window.Promise = WinJS.Promise;
|
||||
@@ -33,8 +33,8 @@ module.exports = {
|
||||
// console.log("screenOrientation proxy called with " + args);
|
||||
|
||||
try {
|
||||
var prefOrients = args[0];
|
||||
var winPrefs = 0;
|
||||
const prefOrients = args[0];
|
||||
let winPrefs = 0;
|
||||
|
||||
if (prefOrients & 1) {
|
||||
// UIInterfaceOrientationPortrait
|
||||
|
||||
+2
-2
@@ -20,7 +20,7 @@
|
||||
*/
|
||||
|
||||
exports.defineAutoTests = function () {
|
||||
var isLockable = false;
|
||||
let isLockable = false;
|
||||
|
||||
beforeAll(function () {
|
||||
// Mobile devices are expected to have a lockable orientation, while
|
||||
@@ -69,7 +69,7 @@ exports.defineAutoTests = function () {
|
||||
// it should be null to start
|
||||
expect(window.screen.orientation.onchange).toBe(null);
|
||||
// then we set it
|
||||
var funk = function () {};
|
||||
const funk = function () {};
|
||||
window.screen.orientation.onchange = funk;
|
||||
// now it should exist
|
||||
expect(window.screen.orientation.onchange).toBeDefined();
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
/* global cordova, OrientationLockType */
|
||||
|
||||
var screenOrientation = {};
|
||||
const screenOrientation = {};
|
||||
if (!window.OrientationType) {
|
||||
window.OrientationType = {
|
||||
'portrait-primary': 0,
|
||||
@@ -41,14 +41,14 @@ if (!window.OrientationLockType) {
|
||||
any: 15 // All orientations are supported (unlocked orientation)
|
||||
};
|
||||
}
|
||||
var orientationMask = 1;
|
||||
let orientationMask = 1;
|
||||
screenOrientation.setOrientation = function (orientation) {
|
||||
orientationMask = window.OrientationLockType[orientation];
|
||||
cordova.exec(null, null, 'CDVOrientation', 'screenOrientation', [orientationMask, orientation]);
|
||||
};
|
||||
|
||||
screenOrientation.lock = function (orientation) {
|
||||
var p = new Promise(function (resolve, reject) {
|
||||
const p = new Promise(function (resolve, reject) {
|
||||
resolveOrientation(orientation, resolve, reject);
|
||||
});
|
||||
return p;
|
||||
@@ -62,7 +62,7 @@ setOrientationProperties();
|
||||
|
||||
function resolveOrientation (orientation, resolve, reject) {
|
||||
if (!Object.prototype.hasOwnProperty.call(OrientationLockType, orientation)) {
|
||||
var err = new Error();
|
||||
const err = new Error();
|
||||
err.name = 'NotSupportedError';
|
||||
reject(err); // "cannot change orientation");
|
||||
} else {
|
||||
@@ -71,7 +71,7 @@ function resolveOrientation (orientation, resolve, reject) {
|
||||
}
|
||||
}
|
||||
|
||||
var onChangeListener = null;
|
||||
let onChangeListener = null;
|
||||
|
||||
Object.defineProperty(screenOrientation, 'onchange', {
|
||||
set: function (listener) {
|
||||
@@ -89,10 +89,10 @@ Object.defineProperty(screenOrientation, 'onchange', {
|
||||
enumerable: true
|
||||
});
|
||||
|
||||
var evtTarget = new XMLHttpRequest(); // document.createElement('div');
|
||||
var orientationchange = function () {
|
||||
const evtTarget = new XMLHttpRequest(); // document.createElement('div');
|
||||
const orientationchange = function () {
|
||||
setOrientationProperties();
|
||||
var event = document.createEvent('Events');
|
||||
const event = document.createEvent('Events');
|
||||
event.initEvent('change', false, false);
|
||||
evtTarget.dispatchEvent(event);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user