Skip to content

Instantly share code, notes, and snippets.

@korof
Forked from mauriciosoares/doubleclick.js
Created June 18, 2016 08:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save korof/8430f5c816ddda76041cd9c0ba7b6206 to your computer and use it in GitHub Desktop.
Save korof/8430f5c816ddda76041cd9c0ba7b6206 to your computer and use it in GitHub Desktop.
rxjs double click example
let clickStream = Rx.Observable.fromEvent(document.getElementById('link'), 'click');
clickStream
.buffer(clickStream.debounce(250))
.map(list => list.length)
.filter(x => x === 2)
.subscribe(() => {
console.log('doubleclick');
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment