Skip to content

Instantly share code, notes, and snippets.

@gsans
Created October 14, 2015 15:14
Show Gist options
  • Save gsans/4a195069c9835c5b0cf8 to your computer and use it in GitHub Desktop.
Save gsans/4a195069c9835c5b0cf8 to your computer and use it in GitHub Desktop.
Idle user snippet
mergedStreams = rx.Observable.merge(
rx.DOM.keydown(document),
rx.DOM.click(document),
rx.DOM.mousemove(document),
rx.DOM.scroll(document),
rx.DOM.touchstart(document)
);
var idleStream = mergedStreams
.bufferWithTime(5000)
.filter(function(arr){
return arr.length===0;
})
.subscribe();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment