<button>Show</button>
<output></output>

import { fromEvent } from "https://cdn.skypack.dev/rxjs@7.3.0";
import {
  bufferWhen,
  delay,
  filter
} from "https://cdn.skypack.dev/rxjs@7.3.0/operators";

const output = document.querySelector("output");
const button = document.querySelector("button");

const click$ = fromEvent(button, "click");

click$
  .pipe(
    bufferWhen(() => click$.pipe(delay(400))), // <--------- during 400ms
    filter((events) => events.length >= 3) // <-------- 3 or more events
  )
  .subscribe(() => {
    output.textContent = Math.random().toString(36).slice(2);
  });

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.