<!DOCTYPE html><htmlclass="default"lang="en"><head><metacharSet="utf-8"/><metahttp-equiv="x-ua-compatible"content="IE=edge"/><title>toAsyncIterator | Documentation</title><metaname="description"content="Documentation for Documentation"/><metaname="viewport"content="width=device-width, initial-scale=1"/><linkrel="stylesheet"href="../assets/style.css"/><linkrel="stylesheet"href="../assets/highlight.css"/><scriptdefersrc="../assets/main.js"></script><scriptasyncsrc="../assets/search.js"id="tsd-search-script"></script><scriptasyncsrc="../assets/navigation.js"id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme=localStorage.getItem("tsd-theme")||"os"</script><headerclass="tsd-page-toolbar"><divclass="tsd-toolbar-contents container"><divclass="table-cell"id="tsd-search"data-base=".."><divclass="field"><labelfor="tsd-search-field"class="tsd-widget tsd-toolbar-icon search no-caption"><svgwidth="16"height="16"viewBox="0 0 16 16"fill="none"><usehref="#icon-search"></use></svg></label><inputtype="text"id="tsd-search-field"aria-label="Search"/></div><divclass="field"><divid="tsd-toolbar-links"></div></div><ulclass="results"><liclass="state loading">Preparing search index...</li><liclass="state failure">The search index is not available</li></ul><ahref="../index.html"class="title">Documentation</a></div><divclass="table-cell"id="tsd-widgets"><ahref="#"class="tsd-widget tsd-toolbar-icon menu no-caption"data-toggle="menu"aria-label="Menu"><svgwidth="16"height="16"viewBox="0 0 16 16"fill="none"><usehref="#icon-menu"></use></svg></a></div></div></header><divclass="container container-main"><divclass="col-content"><divclass="tsd-page-title"><ulclass="tsd-breadcrumb"><li><ahref="../index.html">Documentation</a></li><li><ahref="../modules/_waku_utils.html">@waku/utils</a></li><li><ahref="_waku_utils.toAsyncIterator.html">toAsyncIterator</a></li></ul><h1>Function toAsyncIterator</h1></div><sectionclass="tsd-panel"><ulclass="tsd-signatures"><liclass="tsd-signature tsd-anchor-link"><aid="toAsyncIterator"class="tsd-anchor"></a><spanclass="tsd-kind-call-signature">to<wbr/>Async<wbr/>Iterator</span><spanclass="tsd-signature-symbol"><</span><spanclass="tsd-signature-type tsd-kind-type-parameter">T</span><spanclass="tsd-signature-symbol">></span><spanclass="tsd-signature-symbol">(</span><spanclass="tsd-kind-parameter">receiver</span>, <spanclass="tsd-kind-parameter">decoder</span>, <spanclass="tsd-kind-parameter">iteratorOptions</span><spanclass="tsd-signature-symbol">?</span><spanclass="tsd-signature-symbol">)</span><spanclass="tsd-signature-symbol">: </span><spanclass="tsd-signature-type ">Promise</span><spanclass="tsd-signature-symbol"><</span><ahref="../interfaces/_waku_interfaces.IAsyncIterator.html"class="tsd-signature-type tsd-kind-interface">IAsyncIterator</a><spanclass="tsd-signature-symbol"><</span><spanclass="tsd-signature-type tsd-kind-type-parameter">T</span><spanclass="tsd-signature-symbol">></span><spanclass="tsd-signature-symbol">></span><ahref="#toAsyncIterator"aria-label="Permalink"class="tsd-anchor-icon"><svgviewBox="0 0 24 24"><usehref="#icon-anchor"></use></svg></a></li><liclass="tsd-description"><divclass="tsd-comment tsd-typography"><p>Function that transforms IReceiver subscription to iterable stream of data.</p>
</div><sectionclass="tsd-panel"><h4>Type Parameters</h4><ulclass="tsd-type-parameter-list"><li><h4><spanclass="tsd-kind-type-parameter">T</span><spanclass="tsd-signature-symbol"> extends </span><ahref="../interfaces/_waku_interfaces.IDecodedMessage.html"class="tsd-signature-type tsd-kind-interface">IDecodedMessage</a></h4></li></ul></section><divclass="tsd-parameters"><h4class="tsd-parameters-title">Parameters</h4><ulclass="tsd-parameter-list"><li><h5><spanclass="tsd-kind-parameter">receiver</span>: <ahref="../interfaces/_waku_interfaces.IReceiver.html"class="tsd-signature-type tsd-kind-interface">IReceiver</a></h5><divclass="tsd-comment tsd-typography"><p>object that allows to be subscribed to;</p>
</div><divclass="tsd-comment tsd-typography"></div></li><li><h5><spanclass="tsd-kind-parameter">decoder</span>: <ahref="../interfaces/_waku_interfaces.IDecoder.html"class="tsd-signature-type tsd-kind-interface">IDecoder</a><spanclass="tsd-signature-symbol"><</span><spanclass="tsd-signature-type tsd-kind-type-parameter">T</span><spanclass="tsd-signature-symbol">></span><spanclass="tsd-signature-symbol"> | </span><ahref="../interfaces/_waku_interfaces.IDecoder.html"class="tsd-signature-type tsd-kind-interface">IDecoder</a><spanclass="tsd-signature-symbol"><</span><spanclass="tsd-signature-type tsd-kind-type-parameter">T</span><spanclass="tsd-signature-symbol">></span><spanclass="tsd-signature-symbol">[]</span></h5><divclass="tsd-comment tsd-typography"><p>parameter to be passed to receiver for subscription;</p>
</div><divclass="tsd-comment tsd-typography"></div></li><li><h5><codeclass="tsd-tag ts-flagOptional">Optional</code><spanclass="tsd-kind-parameter">iteratorOptions</span>: <ahref="../types/_waku_utils.IteratorOptions.html"class="tsd-signature-type tsd-kind-type-alias">IteratorOptions</a></h5><divclass="tsd-comment tsd-typography"><p>optional configuration for iterator;</p>
</div><divclass="tsd-comment tsd-typography"></div></li></ul></div><h4class="tsd-returns-title">Returns <spanclass="tsd-signature-type ">Promise</span><spanclass="tsd-signature-symbol"><</span><ahref="../interfaces/_waku_interfaces.IAsyncIterator.html"class="tsd-signature-type tsd-kind-interface">IAsyncIterator</a><spanclass="tsd-signature-symbol"><</span><spanclass="tsd-signature-type tsd-kind-type-parameter">T</span><spanclass="tsd-signature-symbol">></span><spanclass="tsd-signature-symbol">></span></h4><p>iterator and stop function to terminate it.</p>