Skip to content

Instantly share code, notes, and snippets.

@phplaw
Forked from mauriciosoares/doubleclick.js
Created September 10, 2018 22:42
Show Gist options
  • Select an option

  • Save phplaw/8ee48024e553851eec9ca550f0c59d11 to your computer and use it in GitHub Desktop.

Select an option

Save phplaw/8ee48024e553851eec9ca550f0c59d11 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