/** @type {MapPromise} */ const Files = new Map(); globalThis.MODULE = {}; /** @type {(file:string, hnadler:()=>void)} */ export function Register(file, handler) { console.log("registering", file); const WrapperHandler =()=> import(file+"?"+new Date().getTime()).then(handler); Files.set(file, WrapperHandler); } const Loop =async()=> { console.log("looping!"); for (const [fileName, handler] of Files.entries()) { await handler(); } setTimeout(Loop, 3000); } Loop();