Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 | 3x | import { Channel } from './channel.js'
/** @returns channel that closes after specified time in milliseconds. */
export function after<T = unknown>(milliseconds: number) {
const ch = new Channel<T>()
const timeoutId = setTimeout(() => ch.closeWriting(), milliseconds)
ch.onceDoneWriting(() => clearTimeout(timeoutId))
return ch
}
|