Files
discord-decomp/sources/modules/gateway/DispatcherWorkScheduler.native.tsx
T
2026-07-27 16:20:00 +03:00

130 lines
6.6 KiB
TypeScript

/* Metro module 12499; source: modules/gateway/DispatcherWorkScheduler.native.tsx; dependencies: [6, 7, 15, 17, 18, 12498, 661, 694, 12500, 2] */
function _fun95209(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#95209, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12689:6, offset: 0x0213579b, size: 297 bytes, params: 8, frame: 19
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_2 = importDefault(6) /* metro dependency 6 */;
const env0_3 = importDefault(7) /* metro dependency 7 */;
const env0_4 = importDefault(15) /* metro dependency 15 */;
const env0_5 = importDefault(17) /* metro dependency 17 */;
const env0_6 = importDefault(18) /* metro dependency 18 */;
const dispatcherWorkConstantsModule = require(12498) /* metro dependency 12498: DispatcherWorkConstants */;
const env0_7 = dispatcherWorkConstantsModule.DISPATCHER_CALLBACK_MAX_TIME_REMAINING_MS;
const env0_8 = dispatcherWorkConstantsModule.NATIVE_WORK_BACKOFF_MS;
const env0_9 = dispatcherWorkConstantsModule.NATIVE_WORK_DEADLINE_MS;
const env0_10 = dispatcherWorkConstantsModule.WorkIdleDeadline;
const env0_11 = (require(661) /* metro dependency 661: Constants */).AppStates;
const BasicWorkScheduler = (require(12500) /* metro dependency 12500: BasicWorkScheduler */).BasicWorkScheduler;
const env0_12 = _fun95213(BasicWorkScheduler);
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/gateway/DispatcherWorkScheduler.native.tsx');
exports.createDispatcherWorkScheduler = createDispatcherWorkScheduler;
}
function _isNativeReflectConstruct_95210() { // fn#95210, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12689:300, offset: 0x021358c4, size: 98 bytes, params: 1, frame: 18
var Boolean;
var prototype;
var valueOf;
var call;
var Reflect;
var construct;
var closure;
var value;
var error;
try {
Boolean = global.Boolean;
prototype = Boolean.prototype;
valueOf = prototype.valueOf;
call = valueOf.call;
Reflect = global.Reflect;
construct = Reflect.construct;
Boolean = global.Boolean;
closure = function() {
};
value = Reflect.apply(construct, Reflect, [Boolean, [], closure]);
value = Reflect.apply(call, valueOf, [value]);
var result = !value;
} catch (error) {
}
return (_isNativeReflectConstruct_95210_isNativeReflectConstruct = function() {
return !!result;
})();
}
function _fun95213(a0) { // fn#95213, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12689:499, offset: 0x02135926, size: 97 bytes, params: 2, frame: 16
const closure = DispatcherWorkScheduler;
env0_6(closure, a0);
return env0_3(closure, [{key: '_queueIdleCallback', value: function() {
var property;
var env0_0 = this;
if (this._enableRequestIdleCallback) {
if (this._criticalWorkScheduled) {
return this._processWorkCallback();
}
property = global.performance;
var env0_1 = property.now();
property = global.setTimeout;
this._flushIdleHandler = property(_fun95217, 1);
return undefined;
}
return this._processWorkCallback();
}}, {key: '_clearIdleCallback', value: function() {
if (this._flushIdleHandler != null) {
global.clearTimeout(this._flushIdleHandler);
this._flushIdleHandler = null;
}
}}]);
}
function createDispatcherWorkScheduler() { // fn#95219, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12689:1621, offset: 0x02135b6d, size: 29 bytes, params: 1, frame: 9
const binding = env0_12;
const value = Object.create(binding.prototype, {constructor: {value: binding}});
const binding2 = new binding();
return binding2 instanceof Object ? binding2 : value;
}
function DispatcherWorkScheduler() { // fn#95214, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12689:511, offset: 0x02135987, size: 157 bytes, params: 1, frame: 21
var environment;
const value = environment.__proto__;
env1_2(this, DispatcherWorkScheduler);
const value3 = env1_5(DispatcherWorkScheduler);
const value6 = env1_4(this, _isNativeReflectConstruct_95210() ? global.Reflect.construct(value3, [],
env1_5(this).constructor) : value3.apply(this, undefined));
(importDefault(694) /* metro dependency 694: Dispatcher */).subscribe('APP_STATE_UPDATE', _fun95215);
return value6;
}
function value_95216() { // fn#95216, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12689:957, offset: 0x02135a55, size: 92 bytes, params: 1, frame: 14
if (this._enableRequestIdleCallback) {
if (this._criticalWorkScheduled) {
return this._processWorkCallback();
}
var env0_1 = global.performance.now();
this._flushIdleHandler = global.setTimeout(_fun95217, 1);
return undefined;
}
return this._processWorkCallback();
}
function _fun95215({state}) { // fn#95215, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12689:793, offset: 0x02135a24, size: 49 bytes, params: 2, frame: 12
const BACKGROUND = AppStates.BACKGROUND;
env0_0._trackAppBackgrounded(state === BACKGROUND);
}
function _fun95217() { // fn#95217, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12689:1127, offset: 0x02135ab1, size: 142 bytes, params: 1, frame: 18
let value = global.performance.now();
value -= env0_1;
const binding = env0_0;
const _processWorkCallback = binding._processWorkCallback;
const _consecutiveFlushesBeforeQueueEmpty = binding._consecutiveFlushesBeforeQueueEmpty;
let Math = global.Math;
let max = Math.max;
value = Reflect.apply(max, Math, [0, NATIVE_WORK_DEADLINE_MS - value]);
Math = global.Math;
max = Math.max;
value += NATIVE_WORK_BACKOFF_MS * _consecutiveFlushesBeforeQueueEmpty;
value = Reflect.apply(max, Math, [value, DISPATCHER_CALLBACK_MAX_TIME_REMAINING_MS]);
const value4 = Object.create(WorkIdleDeadline.prototype, {constructor: {value: WorkIdleDeadline}});
const workIdleDeadline = new WorkIdleDeadline(value, false);
Reflect.apply(_processWorkCallback, binding, [workIdleDeadline instanceof Object ? workIdleDeadline : value4]);
}