Skip to content

How to: Stop listening to events

Greg Myers edited this page Nov 29, 2017 · 2 revisions

Based on discussion here: [[https://github.com/reactjs/react-rails/issues/805][#805]]

If you want to stop listening to a specified event, it's possible to name the events to stop listening to.

ReactRailsUJS.removeEvent('turbolinks:render', ReactRailsUJS.handleMount);
ReactRailsUJS.removeEvent('DOMContentLoaded', ReactRailsUJS.handleMount);
$(window).on('load', function() {
  ReactRailsUJS.handleMount();
  ReactRailsUJS.detectEvents();
})

Thanks @anaumov

Clone this wiki locally