Skip to content

Instantly share code, notes, and snippets.

@wolfflow
Created January 18, 2013 07:39
Show Gist options
  • Save wolfflow/4562954 to your computer and use it in GitHub Desktop.
Save wolfflow/4562954 to your computer and use it in GitHub Desktop.
BaconJS activity/inactivity detection
activity = $(document).asEventStream "keyup mousemove"
inactivity = activity.skipDuplicates().map((x)->x.timeStamp).toProperty("")
activity.subscribe(-> $("#test").show())
inactivity.combine(inactivity.delay(1500), (a, b) -> a is b)
.filter((x)->x).subscribe(-> $("#test").hide())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment