UNPKG

react_ujs

Version:

Rails UJS for the react-rails gem

18 lines (16 loc) 529 B
module.exports = { // Attach handlers to browser events to mount // (There are no unmount handlers since the page is destroyed on navigation) setup: function(ujs) { if ('addEventListener' in window) { ujs.handleEvent('DOMContentLoaded', ujs.handleMount); } else { // add support to IE8 without jQuery ujs.handleEvent('onload', ujs.handleMount); } }, teardown: function(ujs) { ujs.removeEvent('DOMContentLoaded', ujs.handleMount); ujs.removeEvent('onload', ujs.handleMount); } }