We are all excited in a new addition to rails plugins family that is turbolinks.
First have your $.ready trigger the “page:change” event. This is done, so we can bind everything that is now bound to document.ready to “page:change”
$.ready -> triggerEvent "page:change" triggerEvent = (name) -> event = document.createEvent 'Events' event.initEvent name, true, true document.dispatchEvent event
Now when we have $.ready calling “page:change” we can use it in our application like this
document.addEventListener "page:change", -> alert "I am called from $.ready and page:change"