Macil / browserify-hmr

Hot Module Replacement plugin for Browserify
MIT License
373 stars 26 forks source link

[Feature-request] Dispatch custom DOM events when HMR updates modules #44

Open nesterow opened 5 years ago

nesterow commented 5 years ago

Hello, I don't know if this project accepts feature requests, but anyway...

There are cases when dispatching a DOM event could be very useful. For example, I use Turbolinks in my project so I need to call window.location.reload() in order to get updated script. I could subscribe to the HMR socket, but subscribing to an event seems like better solution, because in that case I don't need to check if my application uses development build or production version (hmr wouldn't get to prod build anyway and the event wouldn't be triggered).

Currently, I use a custom version from forked repository, but I think this feature would be useful for someone else.