Files
todo-frontend/node_modules/licia/orientation.js
Agent d12eea7693
Some checks failed
continuous-integration/drone/push Build is failing
fix: 微信登录补充保存username和role
2026-04-04 07:35:21 +00:00

27 lines
654 B
JavaScript

var Emitter = require('./Emitter');
var safeGet = require('./safeGet');
var screen = window.screen;
exports = {
get: function() {
if (screen) {
var orientation = safeGet(screen, 'orientation.type');
if (orientation) return orientation.split('-').shift();
}
return window.innerWidth > window.innerHeight
? 'landscape'
: 'portrait';
}
};
Emitter.mixin(exports);
window.addEventListener(
'orientationchange',
function() {
setTimeout(function() {
exports.emit('change', exports.get());
}, 200);
},
false
);
module.exports = exports;