From 431e4fc9d1657a50ebc34b8ac24f9bfaea06417f Mon Sep 17 00:00:00 2001 From: Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> Date: Sat, 17 Sep 2022 19:39:05 +0800 Subject: Initial move to babel + change fetch to use async/await --- utils/delayUtils.js | 29 ----------------------------- 1 file changed, 29 deletions(-) delete mode 100644 utils/delayUtils.js (limited to 'utils/delayUtils.js') diff --git a/utils/delayUtils.js b/utils/delayUtils.js deleted file mode 100644 index 3ec6d95..0000000 --- a/utils/delayUtils.js +++ /dev/null @@ -1,29 +0,0 @@ -const { default: FlatQueue } = require("../datastructures/flatqueue") - -if (!global.delayThingSoopy) { - - let functionQueue = new FlatQueue() - let functions = new Map() - let functionId = 0 - - function delay(time, callback) { - let id = functionId++ - functions.set(id, callback) - functionQueue.push(id, Date.now() + time) - } - - register("tick", () => { - while (functionQueue.length > 0 && Date.now() > functionQueue.peekValue()) { - let id = functionQueue.pop() - - functions.get(id)() - functions.delete(id) - } - }) - - global.delayThingSoopy = { - delay: delay - } -} - -module.exports = global.delayThingSoopy -- cgit