comptime.ts
Version:
<div align="center"> <img src="https://raw.githubusercontent.com/feathers-studio/comptime.ts/master/docs/comptime.ts.svg" alt="Hyperactive"> </div>
17 lines • 574 B
JavaScript
import { process } from "./util.js";
export let asyncLocalStore;
try {
// avoid an unnecessary import attempt if we're not in a node-like environment
if (!process)
throw new Error();
const AsyncLocalStorage = (await import("node:async_hooks")).AsyncLocalStorage;
asyncLocalStore = new AsyncLocalStorage();
}
catch {
// noop AsyncLocalStorage implementation if we're not in a node-like environment
asyncLocalStore = {
run: (_, callback) => callback(),
getStore: () => undefined,
};
}
//# sourceMappingURL=async_store.js.map