(value, func)
| 14 | |
| 15 | /** @param {any} value @param {() => Promise<any>} func */ |
| 16 | export async function createContext(value, func) { |
| 17 | const key = "🫨🫨" + Math.random().toString(16) + "🫨🫨"; |
| 18 | contextMap.set(key, value); |
| 19 | |
| 20 | const fn = { |
| 21 | async [key]() { |
| 22 | return await func(); |
| 23 | }, |
| 24 | }[key]; |
| 25 | await fn(); |
| 26 | contextMap.delete(key); |
| 27 | } |