Skip to content
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

feat(js-runtime): async context #684

Merged
merged 4 commits into from
Mar 24, 2023
Merged

feat(js-runtime): async context #684

merged 4 commits into from
Mar 24, 2023

Conversation

QuiiBz
Copy link
Member

@QuiiBz QuiiBz commented Mar 24, 2023

About

Closes #612

Basic tests are ported from https://github.com/tc39/proposal-async-context/blob/master/tests/async-context.test.ts

Add AsyncLocalStorage and AsyncContext APIs. The former extends the latter since they provide the same functionalities. Only a subset of Node.js's AsyncLocalStorage is implemented:

  • AsyncLocalStorage.prototype.getStore()
  • AsyncLocalStorage.prototype.run(store, callback, ...args)

This implementation is very basic and might have bugs. It also works through timers (setTimeout(), setInterval()) and microtasks (queueMicrotask())

@changeset-bot
Copy link

changeset-bot bot commented Mar 24, 2023

🦋 Changeset detected

Latest commit: cc127ab

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@lagon/cli Patch
@lagon/docs Patch
@lagon/js-runtime Patch
@lagon/runtime Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Mar 24, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated
docs ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Mar 24, 2023 at 1:09PM (UTC)
3 Ignored Deployments
Name Status Preview Comments Updated
dashboard ⬜️ Ignored (Inspect) Visit Preview Mar 24, 2023 at 1:09PM (UTC)
storybook ⬜️ Ignored (Inspect) Visit Preview Mar 24, 2023 at 1:09PM (UTC)
www ⬜️ Ignored (Inspect) Visit Preview Mar 24, 2023 at 1:09PM (UTC)

@QuiiBz QuiiBz marked this pull request as ready for review March 24, 2023 16:22
@QuiiBz QuiiBz merged commit 9da1136 into main Mar 24, 2023
@QuiiBz QuiiBz deleted the feat/runtime-asynccontext branch March 24, 2023 16:22
@QuiiBz QuiiBz mentioned this pull request Mar 24, 2023
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.

AsyncLocalStorage API
1 participant