GoogleChromeLabs / GoogleChromeLabs/comlink

"Proxy" is a loaded term in the docs. Should be named `Remote` when referring to symbol methods

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

Description

> Every proxy created by Comlink has the `[releaseProxy]()` method. Calling it will detach the proxy and the exposed object from the message channel, allowing both ends to be garbage collected.

However this isn't true. This won't work:
```ts
import { proxy, releaseProxy } from "comlink";

const proxied = proxy({});
proxy[releaseProxy]();
```

One would think that the return type of a `proxy` function would count as a proxy, but it's not.

Only `Remote` types have the `ProxyMethods` on them:
https://github.com/GoogleChromeLabs/comlink/blob/main/src/comlink.ts#LL138C8-L138C8

The docs should maybe say that every `Remote` created by a `wrap` has a `[releaseProxy]()` method.

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.