GoogleChromeLabs / GoogleChromeLabs/comlink

Feature Request: Expose endpoint

Open
#405 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
12.8k
Forks
435
PR merge metrics
No merged PRs in 30d

Description

Related to #372

Although there are ways of getting around this, it would make things much more convenient to expose the endpoint on a proxy property. I'm using comlink-loader, which makes it impossible to access the original WebWorker instance.

What I'd love is something like:

```javascript
import { endpointMarker } from 'comlink'
import myProxy from 'webpack/magic/here'

// do a long job...
myProxy.doStuff().then(...)

// oops i want to cancel
let worker = myProxy[endpointMarker]
worker.terminate()
```

I imagine this would be easy enough to implement. Hoping you think so too! :)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.