0

I am bundling my Deno code for the web using deno bundle and I know the browser has RTCPeerConnection from the WebRTC API which I would like to use.

I thought Deno was aiming to have web compatibility, so I don't see why WebRTC is not planned to be implemented.

But since it isn't at the moment, how can I tell Deno to trust that this global variable exists and to compile?

4

1 回答 1

1

对于 Deno 语言支持的许多 Web API,使用deno bundle实际上运行良好。

我对其他 api 的临时解决方案crypto如下:

declare crypto: any;

这篇文章也可能很有用(请参阅“编译和捆绑”部分)。


编辑:为了支持各种各样的环境,在许多情况下,依赖注入可能是一个很好的解决方案。

于 2020-05-18T15:39:14.037 回答