feat: add cursor settings, enhance setup wizard and loading animations
This commit is contained in:
20
src/lib/displayUtils.ts
Normal file
20
src/lib/displayUtils.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
export function estimateRefreshRate(): Promise<number> {
|
||||
return new Promise((resolve) => {
|
||||
let last = performance.now();
|
||||
let frames = 0;
|
||||
|
||||
function loop() {
|
||||
const now = performance.now();
|
||||
frames++;
|
||||
|
||||
if (now - last >= 1000) {
|
||||
console.log(`Estimated Refresh Rate: ${frames} FPS`);
|
||||
resolve(frames); // estimated Hz
|
||||
} else {
|
||||
requestAnimationFrame(loop);
|
||||
}
|
||||
}
|
||||
|
||||
requestAnimationFrame(loop);
|
||||
});
|
||||
}
|
Reference in New Issue
Block a user