Is there an equalant way to convert this small cod...
# getting-started
a
Is there an equalant way to convert this small code in RxJS to Kotlin flow I'm not really getting the way in which this java script convert the click events to an array in the map.
var button = document.querySelector('.button');
var label = document.querySelector('h4');
var clickStream = Rx.Observable.fromEvent(button, 'click');
var doubleClickStream = clickStream
  
.bufferWhen(() => clickStream.debounceTime(250))
  
.map(arr => arr.length)
  
.filter(len => len === 2);
doubleClickStream.subscribe(event => {
  
label.textContent = 'double click';
});
doubleClickStream
  
.delay(1000)
  
.subscribe(suggestion => {
    
label.textContent = '-';
  
});
Copy code
doubleClickStream = buttonClickStream?.debounce(250)?.buffer().map {  }
I'm try the code in kotlin however map never gets the list of events as an array
r
Nothing will happen until you use a terminal operator to start the flow. Similar to how nothing happens with RxJS until you subscribe. https://kotlinlang.org/docs/flow.html#terminal-flow-operators Also, check out: #flow