-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clean Context #104
Comments
Just for context, in Node.js this is |
the const asyncVar = new AsyncContext.Variable();
const sandbox = new AsyncContext.Snapshot()
// Sets the current value to 'top', and executes the `main` function.
asyncVar.run("top", main);
function main() {
sandbox.run(() => {
console.log(asyncVar.get()); // => undefined
});
} |
Yes, but CommonJS libraries in Node.js would not have access to the global scope. In the web integration, we are proposing that some event listeners (e.g. for a user-caused |
Having complex systems with various variables could result in leaking unintended values to subsystems. It might be reasonable to have something like
AsyncContext.sandbox(() => {... })
which reset's all the state, preventing parents to interfere.The text was updated successfully, but these errors were encountered: