baseprime / grapnel

The smallest JavaScript router with named parameters, HTML5 pushState, and middleware support
http://grapnel.js.org
468 stars 40 forks source link

Possible to access click event data within a route? #59

Closed jackw closed 6 years ago

jackw commented 8 years ago

Hey, I'm currently in the process of trying to integrate grapnel into a javascript app that uses knockout and I've hit a bit of a wall.

I've got quite a few buttons in this app and they all run various functions that fire off modals and the such. Knockout has this rather neat feature where it passes the context on a click event to the handler. Rather than rip this entire app to pieces and start again I was wondering if there was any way to get hold of this data on a click event and pass it into a route handler?

I've put together a very cut back knockout example to try and help explain what I want to achieve.

https://jsfiddle.net/nt0j49x7/1/