Files
discord-decomp/sources/by-id/module-06495-JSFPSMonitor.js
2026-07-28 01:06:53 +03:00

107 lines
5.8 KiB
JavaScript

/* Metro module 6495; source: unknown; dependencies: [6374, 6375, 6394, 6496] */
import ClassCallCheck from './module-06374-ClassCallCheck.js'; /* Metro dependency 6374 */
import CreateClass from './module-06375-CreateClass.js'; /* Metro dependency 6375 */
function _fun51163(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#51163, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6673:6, offset: 0x0122ac3b, size: 104 bytes, params: 8, frame: 18
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
exports.JSFPSMonitor = _fun51164();
function _fun51164() { // fn#51164, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6673:118, offset: 0x0122aca3, size: 101 bytes, params: 1, frame: 15
return CreateClass(JSFPSMonitor_51165, [{key: 'measureLoop', value: function() {
this.clearAnimationNumber = global.requestAnimationFrame(this.updateLoopCompute);
}}, {key: 'startTracking', value: value_51168}, {key: 'stopAndGetData', value: value_51169}]);
function JSFPSMonitor_51165() { // fn#51165, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6673:139, offset: 0x0122ad08, size: 116 bytes, params: 1, frame: 14
env1_2(this, JSFPSMonitor_51165);
this.startTime = 0;
this.frameCount = 0;
this.timeWindow = {'frameCount': 0, 'startTime': 0};
const Number = global.Number;
const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER;
this.minFPS = MAX_SAFE_INTEGER;
this.maxFPS = 0;
this.averageFPS = 0;
this.clearAnimationNumber = 0;
this.updateLoopCompute = updateLoopCompute_51166;
function JSFPSMonitor_51165UpdateLoopCompute() { // fn#51166, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6673:392, owner: JSFPSMonitor_51165.updateLoopCompute, offset: 0x01228d5b, size: 289 bytes, params: 1, frame: 17
var value8;
var Math;
let binding = env0_0;
let frameCount = binding.frameCount;
binding.frameCount = typeof frameCount === 'bigint' ? frameCount + 1n : +frameCount + 1;
let Date = global.Date;
const value3 = (Date.now() - binding.startTime) / 1000;
const value4 = 0;
binding.averageFPS = value3 > value4 ? env0_0.frameCount / value3 : value4;
binding = env0_0;
let timeWindow = binding.timeWindow;
frameCount = timeWindow.frameCount;
timeWindow.frameCount = typeof frameCount === 'bigint' ? frameCount + 1n : +frameCount + 1;
Date = global.Date;
const value7 = (Date.now() - binding.timeWindow.startTime) / 1000;
if (value7 >= 1) {
binding = env0_0;
timeWindow = binding.timeWindow;
value8 = timeWindow.frameCount / value7;
Math = global.Math;
binding.minFPS = Math.min(binding.minFPS, value8);
Math = global.Math;
binding.maxFPS = Math.max(binding.maxFPS, value8);
timeWindow = binding.timeWindow;
timeWindow.frameCount = value4;
timeWindow = binding.timeWindow;
timeWindow.startTime = global.Date.now();
}
env0_0.measureLoop();
}
}
function value_51168() { // fn#51168, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6673:889, offset: 0x0122ad7c, size: 146 bytes, params: 1, frame: 12
var Error;
var value;
var fpsMonitorAlreadyRunning;
if (this.startTime !== 0) {
Error = global.Error;
value = environment.__proto__;
fpsMonitorAlreadyRunning = (require(6394) /* metro dependency 6394 */).ErrorMessages.fpsMonitorAlreadyRunning;
throw new Error();
}
let Date = global.Date;
this.startTime = Date.now();
const timeWindow = this.timeWindow;
Date = global.Date;
timeWindow.startTime = Date.now();
this.measureLoop();
}
function value_51169() { // fn#51169, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6673:1112, offset: 0x0122ae0e, size: 187 bytes, params: 1, frame: 19
var averageFPS;
global.cancelAnimationFrame(this.clearAnimationNumber);
const minFPS = this.minFPS;
const Number = global.Number;
const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER;
if (minFPS === MAX_SAFE_INTEGER) {
averageFPS = this.averageFPS;
this.minFPS = averageFPS;
averageFPS = this.averageFPS;
this.maxFPS = averageFPS;
}
const object = {};
let value = environment.__proto__;
value = require(6496) /* metro dependency 6496 */;
object.minFPS = value.roundToDecimalPlaces(this.minFPS, 1);
value = require(6496) /* metro dependency 6496 */;
object.maxFPS = value.roundToDecimalPlaces(this.maxFPS, 1);
value = require(6496) /* metro dependency 6496 */;
object.averageFPS = value.roundToDecimalPlaces(this.averageFPS, 1);
return object;
}
}
}
global.__d(_fun51163, 6495, [6374, 6375, 6394,
6496]) /* metro module 6495, dependencies: [6374, 6375, 6394, 6496] */;