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: introduce $close method and bind option #21

Merged
merged 4 commits into from
Oct 8, 2024

Conversation

sheremet-va
Copy link
Collaborator

Description

This PR addresses two issues I have with the current implementation:

  • The context is lost when I pass down an instance of a class (I don't actually want methods inside to reference each other as rpc calls): https://github.com/vitest-dev/vscode/blob/61b37b9ca6b0415d1c511c3e836bd5f92ba2df67/src/worker/worker.ts#L35
  • There is no native way to stop the promise if the connection has been lost/disconnected, which leads to an infinite promise if the timeout is disabled (needed in Vitest for debugger support). This PR adds a $close method that works similarly to the abort controller (will throw an error in pending promises) - should we use the abort controller instead?

Linked Issues

Additional context

@antfu antfu merged commit 1399e0b into antfu:main Oct 8, 2024
2 checks passed
@sheremet-va sheremet-va deleted the feat/$close-bind branch October 8, 2024 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants