From 82ca6269d2dc74f0f9fab7e138291ceabd8ad5bb Mon Sep 17 00:00:00 2001 From: seijihariki Date: Wed, 4 Jan 2023 21:14:52 +0000 Subject: [PATCH] Prettified Code! --- js/ui/tool/dream.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/js/ui/tool/dream.js b/js/ui/tool/dream.js index b3453c6..1486b67 100644 --- a/js/ui/tool/dream.js +++ b/js/ui/tool/dream.js @@ -75,15 +75,17 @@ const _monitorProgress = (bb, oncheck = null) => { }; }; -let busy = false +let busy = false; const generating = (val) => { - busy = val + busy = val; if (busy) { - window.onbeforeunload = async () => { await sendInterrupt(); }; - } else { - window.onbeforeunload = null + window.onbeforeunload = async () => { + await sendInterrupt(); + }; + } else { + window.onbeforeunload = null; } -} +}; /** * Starts a dream @@ -733,7 +735,7 @@ const _generate = async (endpoint, request, bb, options = {}) => { mouse.listen.world.btn.middle.onclick.clear(onmorehandler); mouse.listen.world.onwheel.clear(onwheelhandler); isDreamComplete = true; - generating(false) + generating(false); }; redraw();