Proxies

Proxies are a plain functions which always accept a channel as an argument and return a channel which is augmented with an additional set of features using JavaScript Proxy object.

closeOnAllValuesTaken

import { closeOnAllValuesTaken } from 'csp-coffee/channel/proxies/closeOnAllValuesTaken'

This proxy will make sure that the channel is automatically closed once all values are taken.

closeOnEmptyBuffer

import { closeOnEmptyBuffer } from 'csp-coffee/channel/proxies/closeOnAllValuesTaken'

This proxy is mostly for internal usage. In some places channel's buffer may become empty without any take operations involved and this proxy is responsivle for checking whether there are no values in the channel on each read access to isClosed property.

Last updated