Elide provides AsyncLocalStorage, AsyncResource, createHook,
executionAsyncId, triggerAsyncId, executionAsyncResource, and
asyncWrapProviders.
AsyncLocalStorage supports run, exit, getStore, enterWith, disable,
snapshot, and bind. Context propagation is partial in Elide 1.5.0:
synchronous code and a timer created inside run can observe the store, while
a Promise continuation cannot.
import { AsyncLocalStorage } from "node:async_hooks";
const storage = new AsyncLocalStorage();
storage.run("request", () => {
console.log(storage.getStore()); // request
Promise.resolve().then(() => {
console.log(storage.getStore()); // undefined in Elide 1.5.0
});
});createHook() returns an object with enable() and disable(), but Elide
1.5.0 does not provide the full Node async-resource lifecycle. Libraries that
require context across await should not rely on this implementation.