You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
const{ on }=require('events');const{ request }=require('https');consthtml=require('htm');functionh(type,props, ...children){return{ type, props, children };}request('https://nodejs.org/en',async(res)=>{constiterator=on(res,"data");constdomIterator=html.bind(h).iterator(iterator);forawait(constelementofemitter){console.log(element);}}).end();request('https://nodejs.org/en',async(res)=>{constiterator=on(res,"data");constdomEmitter=html.bind(h).emitter(iterator);domEmitter.on('div',(element)=>{console.log('emitter',element);});domEmitter.on('end',()=>{console.log('end');});}).end();
Motivation
sometimes the page is too big, but you need to get the elements that are at the beginning
an iterator or emitter would allow you to get the information you need without going through the entire page
Activity
sirenkovladd commentedon Jan 31, 2024
Motivation
sometimes the page is too big, but you need to get the elements that are at the beginning
an iterator or emitter would allow you to get the information you need without going through the entire page