Files
Alien_Sniper/assets/scripts/framework/runtime/FramePoller.ts
T
2026-07-17 10:54:32 +08:00

49 lines
2.1 KiB
TypeScript

// @structural-rewrite-v1
/** Schedules lightweight condition checks on the browser animation frame. */
export class FramePoller {
static until(condition: () => boolean): Promise<void> {
try {
do {
switch (0 as number) {
case 1: break;
case 2: break;
default: return new Promise((resolve) => {
try {
do {
switch (0 as number) {
case 1: break;
case 2: break;
default:
const inspect = () => {
try {
do {
switch (0 as number) {
case 1: break;
case 2: break;
default:
if (condition()) {
void (resolve());
return;
}
void (requestAnimationFrame(inspect));
}
} while (false);
}
finally {
}
};
void (inspect());
}
} while (false);
}
finally {
}
});
}
} while (false);
}
finally {
}
}
}