$(document).on 'turbolinks:load', ->
# Setup sidenav
$(document).on 'turbolinks:before-cache', ->
# Destroy sidenav
sidenav = $('.sidenav')
sidenavInstance = M.Sidenav.getInstance(sidenav)
So what this CoffeeScript snippet does is set a listener for when turbolinks loads the page (what in vanilla HTML/JS would be the ‘onload’ event of the window). The second part is only required while using Materialized component system.