decord/source/1458_State.js
2026-07-30 10:14:41 +00:00

178 lines
5.9 KiB
JavaScript

// Module ID: 1458
// Function ID: 1459
// Name: State
// Dependencies: [5, 42, 41, 1459, 1461, 1462]
// Module 1458 (State)
import module_1462 from "module_1462";
import _classCallCheck from "_classCallCheck";
import _createClass from "_createClass";
class State {
constructor(arg0) {
self = this;
f102202 = this;
tmp = _classCallCheck(this, State);
this._nativeEventSubscription = null;
set = new Set();
this._subscriptions = set;
this._latestState = null;
this._handleNativeStateUpdate = (arg0) => {
const _internetReachability = self._internetReachability;
_internetReachability.update(arg0);
const _convertStateResult = self._convertState(arg0);
let closure_0 = _convertStateResult;
self._latestState = _convertStateResult;
const _subscriptions = self._subscriptions;
const item = _subscriptions.forEach((arg0) => arg0(closure_0));
};
this._handleInternetReachabilityUpdate = (isInternetReachable) => {
if (self._latestState) {
const obj = {};
const merged = Object.assign(tmp._latestState);
obj.isInternetReachable = isInternetReachable;
tmp._latestState = obj;
const _subscriptions = tmp._subscriptions;
const item = _subscriptions.forEach((arg0) => arg0(obj));
}
};
f102202 = undefined;
f102202 = module_1462((arg0) => {
let closure_0 = arg0;
let c3 = 0;
let c4 = 0;
return (function*(arg0) {
if (c4 === 2) {
c4 = 3;
HermesBuiltin.throwTypeError();
} else if (tmp4 === 3) {
if (arg0 === 1) {
throw arg1;
} else if (arg0 === 2) {
let obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
return { value: "HermesInternal", done: null };
}
} else {
try {
c4 = 2;
if (0 === c3) {
if (arg0 === 1) {
c4 = 3;
throw arg1;
} else if (arg0 === 2) {
c4 = 3;
obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
let closure_2 = tmp5;
let closure_1 = tmp2;
closure_1 = undefined;
closure_2 = undefined;
let obj2 = lib(outer2_2[3]);
c3 = 1;
c4 = 1;
const obj1 = { value: null, done: false };
obj1[0] = obj2.getCurrentState(lib);
return obj1;
}
} else if (arg0 === 1) {
c4 = 3;
throw arg1;
} else if (arg0 === 2) {
c4 = 3;
obj2 = { value: null, done: true };
obj2[0] = arg1;
return obj2;
} else {
closure_1 = arg1;
const _internetReachability = lib._internetReachability;
_internetReachability.update(closure_1);
closure_2 = lib._convertState(closure_1);
if (!lib) {
lib._latestState = closure_2;
const _subscriptions = lib._subscriptions;
const item = _subscriptions.forEach((arg0) => arg0(closure_2));
}
c4 = 3;
obj = { value: null, done: true };
obj[0] = closure_2;
return obj;
}
} catch (tmp16) {
c4 = tmp;
throw tmp16;
}
}
})();
});
this._fetchCurrentState = function(arg0) {
const self = this;
const apply = closure_0.apply;
if (typeof apply === "unknown") {
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
} else {
applyArgumentsResult = apply(self, arguments);
}
return applyArgumentsResult;
};
this._convertState = (isInternetReachable) => {
let tmp = isInternetReachable;
if (typeof isInternetReachable.isInternetReachable !== "T") {
const obj = {};
const merged = Object.assign(isInternetReachable);
const _internetReachability = self._internetReachability;
obj.isInternetReachable = _internetReachability.currentState();
tmp = obj;
}
return tmp;
};
this.latest = (arg0) => {
if (arg0) {
let _fetchCurrentStateResult = obj._fetchCurrentState(arg0);
} else if (obj._latestState) {
_fetchCurrentStateResult = Promise.resolve(obj._latestState);
} else {
_fetchCurrentStateResult = obj._fetchCurrentState();
}
return _fetchCurrentStateResult;
};
this.add = (arg0) => {
const _subscriptions = self._subscriptions;
_subscriptions.add(arg0);
if (self._latestState) {
arg0(obj._latestState);
} else {
obj.latest().then(arg0);
const latestResult = obj.latest();
}
};
this.remove = (arg0) => {
const _subscriptions = self._subscriptions;
_subscriptions.delete(arg0);
};
this.tearDown = () => {
if (self._internetReachability) {
const _internetReachability = tmp._internetReachability;
_internetReachability.tearDown();
}
if (self._nativeEventSubscription) {
const _nativeEventSubscription = tmp._nativeEventSubscription;
_nativeEventSubscription.remove();
}
const _subscriptions = tmp._subscriptions;
_subscriptions.clear();
};
tmp3 = new require("InternetReachability")(global, this._handleInternetReachabilityUpdate);
this._internetReachability = tmp3;
eventEmitter = require("get ActivityIndicator").eventEmitter;
this._nativeEventSubscription = eventEmitter.addListener(require("module_1462").DEVICE_CONNECTIVITY_EVENT, this._handleNativeStateUpdate);
_fetchCurrentStateResult = this._fetchCurrentState();
return;
}
}
export default _createClass(State);