decord/source/1701_Sensor.js
2026-08-24 06:08:38 +00:00

85 lines
2.2 KiB
JavaScript

// Module ID: 1701
// Function ID: 1702
// Name: Sensor
// Dependencies: [41, 42, 1679, 1691, 1662]
// Module 1701 (Sensor)
import _createClassDefault from "_createClass" /* 42 */;
import closure_2 from "_classCallCheck" /* 41 */;
const Sensor = arg1;
class Sensor {
constructor(arg0, arg1) {
tmp = closure_2(this, Sensor);
this.listenersNumber = 0;
this.sensorId = null;
this.sensorType = global;
this.config = arg1;
tmp2 = Sensor;
tmp3 = closure_1;
if (global === require("isWorkletFunction").SensorType.ROTATION) {
tmp2Result = require("addCompilerSafeGetAndSet");
mutable = tmp2Result.makeMutable({ qw: 0, qx: 0, qy: 0, qz: 0, yaw: 0, pitch: 0, roll: 0, interfaceOrientation: 0 });
} else {
tmp2Result1 = require("addCompilerSafeGetAndSet");
mutable = tmp2Result1.makeMutable({ x: 0, y: 0, z: 0, interfaceOrientation: 0 });
}
this.data = mutable;
return;
}
}
const items = [
{
key: "register",
value: function register(arg0) {
const self = this;
({ config, sensorType } = this);
const ReanimatedModule = Sensor(1662).ReanimatedModule;
let num = -1;
if ("auto" !== config.interval) {
num = config.interval;
}
self.sensorId = ReanimatedModule.registerSensor(sensorType, num, config.iosReferenceFrame, arg0);
return -1 !== self.sensorId;
}
},
{
key: "isRunning",
value: function isRunning() {
let tmp = -1 !== this.sensorId;
if (tmp) {
tmp = null !== this.sensorId;
}
return tmp;
}
},
{
key: "isAvailable",
value: function isAvailable() {
return -1 !== this.sensorId;
}
},
{
key: "getSharedValue",
value: function getSharedValue() {
return this.data;
}
},
{
key: "unregister",
value: function unregister() {
const self = this;
let tmp = null !== this.sensorId;
if (tmp) {
tmp = -1 !== self.sensorId;
}
if (tmp) {
const ReanimatedModule = Sensor(1662).ReanimatedModule;
ReanimatedModule.unregisterSensor(self.sensorId);
}
self.sensorId = null;
}
}
];
export default _createClassDefault(Sensor, items);