wait_until = async (fn, ms = 500) => {
			const start = new Date().getTime();
			do {
				if (fn()) return;
				await new Promise((resolve) => window.setTimeout(resolve, 1));
			} while (new Date().getTime() <= start + ms);
		}
@param {() => boolean} fn
@param {number} ms