Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/ayonli_jsext/chan.ts>Channel#close

A JavaScript extension package for building strong and modern applications.
Latest
method Channel.prototype.close
import { Channel } from "https://deno.land/x/ayonli_jsext@v0.9.72/chan.ts";

Closes the channel. If err is supplied, it will be captured by the receiver.

No more data shall be sent once the channel is closed.

Explicitly closing the channel is not required, if the channel is no longer used, it will be automatically released by the GC. However, if the channel is used in a for await...of... loop, closing the channel will allow the loop to break automatically.

Moreover, if the channel is used between parallel threads, it will no longer be able to release automatically, must explicitly call this function in order to release for GC.

Parameters

optional
err: Error | null = [UNSUPPORTED]