jdan / cleaver

30-second slideshows for hackers
http://jdan.github.io/cleaver
MIT License
4.02k stars 305 forks source link

Add onNavigate function to register event handlers #179

Open tkers opened 5 years ago

tkers commented 5 years ago

This adds an onNavigate function to the included script, enabling themes to add new functionality a bit more easily. I currently could not find a nice way to achieve running a function when navigating to another slide, other than monkey patching window.history.replaceState which is pretty ugly (events like window.onpopstate are not triggered when pushing/replacing a new state).

Granted, this is not the cleanest solution either, so definitely open for alternatives or suggestions.

jdan commented 5 years ago

Hey @tkers, thanks for the PRs! I went ahead and gave you commit access to this repo so feel free to merge these yourself :)