chore:代码重构
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
// @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 {
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user