Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/gauntlet/imports/mod.ts>AsyncPushIterator

Work-in-progress front-end tool which does put a smile on my face
Latest
class AsyncPushIterator
implements AsyncIterator<T>
Re-export
import { AsyncPushIterator } from "https://deno.land/x/gauntlet@v0.0.9/imports/mod.ts";

An AsyncPushIterator is an AsyncIterator that allows pushing data asynchronously. The constructor accepts a setup function which is responsible for setting up the pushing logic (e.g. event listeners) and may return a teardown function which should clean up anything that was done during setup (e.g. removing event listeners). The setup function is called once when the iterator is actually iterated.

Constructors

new
AsyncPushIterator(setup: AsyncPushIteratorSetup<T>)

Properties

protected
done: boolean
protected
optional
error: any
protected
finished: boolean
protected
initialized: boolean
protected
queue: T[]
protected
optional
resolveWait: () => void
protected
setup: AsyncPushIteratorSetup<T>
protected
optional
teardown: () => void
protected
optional
waiting: Promise<void>

Methods

protected
continue(): void
protected
teardownOnce(): void
protected
wait(): Promise<void>
finish(): void

Let the iterator finish, i.e. already pushed values will be iterated, but new values are not accepted. After all pushed values are iterated, the iterator returns (stops).

next(): Promise<IteratorResult<T>>
push(value: T): void

Push a value to the iterator.

return(): Promise<IteratorResult<T>>
throw(err: any): Promise<IteratorResult<T>>