I've got some code that I want to run only on one page of my app, so in my HTML I'm using the following inline JS:
<script>
$(document).on('turbolinks:load', function() {
console.log("Ground control to major tom?")
});
</script>
However, then when the user navigates away from that page - that code is still running on every subsequent visit.
How can I use the turbolinks:load event only for a particular page?
Do I need to somehow 'tear down' that event handler? How would I prevent that from affecting any other turbolinks:load events that I may have?