blob: cfe21c9b19db6cfc5e806d0613ae29daacb7b26f [file] [log] [blame]
const requestFramesUntilTrue = async (resolveCondition, rejectCondition) => {
return new Promise((resolve, reject) => {
if (rejectCondition && rejectCondition()) {
reject();
return;
}
(function tryFrame () {
if (resolveCondition())
resolve();
else
requestAnimationFrame(tryFrame);
})();
});
};