mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-11-16 06:06:11 +01:00
Merge branch 'main' into data-driven
This commit is contained in:
commit
1b08393f65
60 files changed
+434
-474
No files matched your search
@@ -3,11 +3,13 @@ import { useRef } from "react";
|
||||
|
||||
export function useStableProgress() {
|
||||
const { loaded, total } = useProgress();
|
||||
const baseline = useRef(loaded);
|
||||
const progress = useRef(0);
|
||||
const pending = total - baseline.current;
|
||||
|
||||
progress.current = Math.max(
|
||||
progress.current,
|
||||
total === 0 ? 0 : (loaded / total) * 100
|
||||
pending <= 0 ? 0 : ((loaded - baseline.current) / pending) * 100
|
||||
);
|
||||
|
||||
return progress.current;
|
||||
|
||||
Reference in new issue
Block a user