Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4791.js (118.4 MB)
71 lines
2.9 KiB
TypeScript
71 lines
2.9 KiB
TypeScript
// Module ID: 13116
|
|
// Function ID: 13117
|
|
// Name: useActivityTimer
|
|
// Dependencies: [32, 19, 1090, 8220, 1952, 2]
|
|
// Exports: default, formatTime, formatTimeForA11yLabel
|
|
|
|
// Module 13116 (useActivityTimer)
|
|
import DurationsDefault from "Durations" /* 1090 */;
|
|
import utils from "utils" /* 8220 */;
|
|
import _slicedToArray from "module_32" /* 32 */;
|
|
|
|
require = fn;
|
|
const noop = fn(19);
|
|
({ useEffect: closure_4, useState: hasOwnProperty } = noop);
|
|
const size = fn(2);
|
|
let result = size.fileFinishedImporting("modules/user_profile/hooks/useActivityTimer.tsx");
|
|
|
|
export default function useActivityTimer(start) {
|
|
start = start.start;
|
|
let first;
|
|
const interval = new first(1952).Interval();
|
|
first = _slicedToArray(closure_5(interval), 1)[0];
|
|
const tmp3 = _slicedToArray(closure_5(() => Date.now()), 2);
|
|
importDefault = tmp3[1];
|
|
const items = [first];
|
|
closure_4(() => {
|
|
first.start(DurationsDefault.Millis.HALF_SECOND, () => closure_1_1(Date.now()));
|
|
return () => first.stop();
|
|
}, items);
|
|
const diff = start.end - start;
|
|
const result = diff / DurationsDefault.Millis.SECOND;
|
|
const diff1 = tmp3[0] - start;
|
|
const bound = Math.max(Math.min(diff1 / DurationsDefault.Millis.SECOND, result), 0);
|
|
return { elapsed: bound, duration: result, percentage: Math.max(Math.min(bound / result, 1), 0) };
|
|
};
|
|
export const formatTime = function formatTime(arg0) {
|
|
const rounded = Math.floor(arg0);
|
|
const result = rounded % DurationsDefault.Seconds.MINUTE;
|
|
const rounded1 = Math.floor(arg0 / DurationsDefault.Seconds.MINUTE);
|
|
const result1 = rounded1 % DurationsDefault.Seconds.MINUTE;
|
|
const rounded2 = Math.floor(arg0 / DurationsDefault.Seconds.HOUR);
|
|
if (0 === rounded2) {
|
|
const _String4 = String;
|
|
const _String5 = String;
|
|
const StringResult = String(result1);
|
|
const padStartResult = String(result1).padStart(2, "0");
|
|
const _HermesInternal2 = HermesInternal;
|
|
let combined = "" + padStartResult + ":" + String(result).padStart(2, "0");
|
|
const StringResult1 = String(result);
|
|
} else {
|
|
const _String = String;
|
|
const padStartResult1 = String(rounded2).padStart(2, "0");
|
|
const _String2 = String;
|
|
const StringResult2 = String(rounded2);
|
|
const _String3 = String;
|
|
const StringResult3 = String(result1);
|
|
const padStartResult2 = String(result1).padStart(2, "0");
|
|
const _HermesInternal = HermesInternal;
|
|
combined = "" + padStartResult1 + ":" + padStartResult2 + ":" + String(result).padStart(2, "0");
|
|
const StringResult4 = String(result);
|
|
}
|
|
return combined;
|
|
};
|
|
export const formatTimeForA11yLabel = function formatTimeForA11yLabel(arg0) {
|
|
const rounded = Math.floor(arg0);
|
|
const seconds = rounded % DurationsDefault.Seconds.MINUTE;
|
|
const rounded1 = Math.floor(arg0 / DurationsDefault.Seconds.MINUTE);
|
|
const minutes = rounded1 % DurationsDefault.Seconds.MINUTE;
|
|
const hours = Math.floor(arg0 / DurationsDefault.Seconds.HOUR);
|
|
return utils.formatTimestampToA11yLabel({ hours, minutes, seconds });
|
|
};
|