Skip to content

Instantly share code, notes, and snippets.

@wolfflow
Created February 14, 2013 07:46
Show Gist options
  • Save wolfflow/4951194 to your computer and use it in GitHub Desktop.
Save wolfflow/4951194 to your computer and use it in GitHub Desktop.
Bacon.js user defined doubleclick
TIME_INTERVAL = 350
clicked = Bacon.fromEventTarget(document.body, "click").toProperty()
clicked.combine(clicked.delay(TIME_INTERVAL), (a,b)->
a isnt b and a.target is b.target and a.timeStamp - b.timeStamp <= TIME_INTERVAL
)
.filter((x)->x)
.assign((x)->console.log "DONE", x)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment