JsIterator

interface JsIterator<T> : Iterator<JsIterator.JsIteratorResult<T>> , ProxyIterator, ProxyIterable

JS: Iterator

Implements a standards-compliant JavaScript iterator, which either provides streamed values as it is polled, or fails upon value access if an error is encountered.

See also

ProxyIterator

for GraalVM's Truffle iterator interface.

for a result type that can be returned by an iterator.

Inheritors

Types

Link copied to clipboard

Factory helper for creating JavaScript iterators. Static constructor methods for iterators are available on this object (host-side).

Link copied to clipboard
class JsIteratorImpl<T>(iter: Iterator<T>) : JsIterator<T> , ProxyIterator, ProxyIterable, ProxyObject

Default implementation of a JavaScript-compatible iterator, via JsIterator of T and ProxyIterator.

Link copied to clipboard
class JsIteratorResult<T> : ProxyObject

Represents an inner iterator value.

Functions

Link copied to clipboard
open override fun getIterator(): Any
Link copied to clipboard
open override fun getNext(): T?
Link copied to clipboard
abstract operator fun hasNext(): Boolean
Link copied to clipboard
abstract operator override fun next(): JsIterator.JsIteratorResult<T>

Fetch the next value from the current iterator.

Link copied to clipboard

Iterator: Terminate and return with the provided value.

Link copied to clipboard
open fun <T, E : Error> throw(err: E): JsIterator.JsIteratorResult<T>

Iterator: Terminate with the provided err.