68 lines
2.0 KiB
JavaScript
68 lines
2.0 KiB
JavaScript
// Metro module 88 (f89).
|
|
import _classCallCheck from "./_classCallCheck";
|
|
import _createClass from "./_createClass";
|
|
import EventEmitter from "./EventEmitter";
|
|
import Module38 from "./Module38";
|
|
import RCTDeviceEventEmitterImpl from "./RCTDeviceEventEmitterImpl";
|
|
import Module100 from "./Module100";
|
|
let c89_6;
|
|
let env89 = {};
|
|
const c89_4 = new EventEmitter();
|
|
env89[5] = false;
|
|
const Dimensions = function Dimensions() {
|
|
_classCallCheck(this, Dimensions);
|
|
};
|
|
c89_6 = _createClass(Dimensions, null, [{
|
|
key: "get",
|
|
value: function get(a0) {
|
|
Module38(env89[2][a0], "No dimension set for key " + a0);
|
|
return env89[2][a0];
|
|
}
|
|
}, {
|
|
key: "set",
|
|
value: function set(a0) {
|
|
let screen = a0.screen;
|
|
let window2 = a0.window;
|
|
const windowPhysicalPixels = a0.windowPhysicalPixels;
|
|
if (windowPhysicalPixels) {
|
|
window2 = {
|
|
width: windowPhysicalPixels.width / windowPhysicalPixels.scale,
|
|
height: windowPhysicalPixels.height / windowPhysicalPixels.scale,
|
|
scale: windowPhysicalPixels.scale,
|
|
fontScale: windowPhysicalPixels.fontScale
|
|
};
|
|
}
|
|
const screenPhysicalPixels = a0.screenPhysicalPixels;
|
|
if (screenPhysicalPixels) {
|
|
screen = {
|
|
width: screenPhysicalPixels.width / screenPhysicalPixels.scale,
|
|
height: screenPhysicalPixels.height / screenPhysicalPixels.scale,
|
|
scale: screenPhysicalPixels.scale,
|
|
fontScale: screenPhysicalPixels.fontScale
|
|
};
|
|
} else if (screen == null) {
|
|
screen = window2;
|
|
}
|
|
env89[2] = {
|
|
window: window2,
|
|
screen
|
|
};
|
|
if (env89[5]) {
|
|
c89_4.emit("change", env89[2]);
|
|
} else {
|
|
env89[5] = true;
|
|
}
|
|
}
|
|
}, {
|
|
key: "addEventListener",
|
|
value: function(a0, a1) {
|
|
Module38(a0 === "change", "Trying to subscribe to unknown event: \"%s\"", a0);
|
|
return c89_4.addListener(a0, a1);
|
|
}
|
|
}]);
|
|
RCTDeviceEventEmitterImpl.addListener("didUpdateDimensions", (a0) => {
|
|
c89_6.set(a0);
|
|
});
|
|
c89_6.set(Module100.getConstants().Dimensions);
|
|
export default c89_6;
|