Skip to content

Add new AsyncLocalStorage constructor options#3898

Merged
jasnell merged 2 commits intomainfrom
jasnell/add-new-als-options
Jun 12, 2025
Merged

Add new AsyncLocalStorage constructor options#3898
jasnell merged 2 commits intomainfrom
jasnell/add-new-als-options

Conversation

@jasnell
Copy link
Collaborator

@jasnell jasnell commented Apr 7, 2025

These were just today added to Node.js implementation. We likely should hold off merging this until the new options go out in a Node.js release. Just opening this now to get ready. I don't plan to merge this until the first Node.js release with the options is cut.

const als = new AsyncLocalStorage({
  defaultValue: 123,
  name: 'foo',
});
console.log(als.name);  // foo
console.log(als.getStore()); // 123
console.log(als.run(321, () => als.getStore()));  // 321
console.log(als.getStore()); // 123

@jasnell jasnell requested review from anonrig and npaun April 7, 2025 20:59
@jasnell jasnell requested review from a team as code owners April 7, 2025 20:59
jasnell and others added 2 commits June 12, 2025 07:01
These were just recently added to Node.js implementation.
Co-authored-by: Nicholas Paun <npaun@cloudflare.com>
@jasnell jasnell force-pushed the jasnell/add-new-als-options branch from fad03bb to f1b4e1a Compare June 12, 2025 14:07
@jasnell jasnell enabled auto-merge (squash) June 12, 2025 14:07
@jasnell jasnell merged commit ff9bb8f into main Jun 12, 2025
19 checks passed
@jasnell jasnell deleted the jasnell/add-new-als-options branch June 12, 2025 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants