Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Live reloading extension point for those who want JS hot loading today? #58

Open
toranb opened this issue Aug 12, 2016 · 0 comments
Open

Comments

@toranb
Copy link

toranb commented Aug 12, 2016

I've got a hot reloader for JS that uses this project at the core and I'm curious about how I can help provide an extension point of some kind. I realize not everyone has the ability to do hot reloading of JS and even if they could it's likely they all need something a little different to accommodate based on the frontend tech stack.

For example, in the gif below you will see I'm using ember and at this time (early days yet) I'm firing an event from a ember dev tool that will dispatch it back to my application to re-render the component. I couldn't possibly submit a generic pull request here that unlocks hot reloading for all but I could do everything I needed if a special hook was available.

One "creative" solution I came up with was to monkey patch the reloadPage function as it's called at the very end of the reload chain anyway.

window.LiveReload.reloader.reloadPage = function() { //my hot reload JS code }

The one missing piece that would require a pull request/ discussion/ etc is that I need the path when this is called and today reloadPage doesn't take any arguments. This was me thinking more quickly on the subject so it's worth mentioning that we could offer an official override-able hook that is called just before reloadPage and it would be provided path so users "could opt in" for a custom hot reloading method if they wanted.

I personally like the ability to have an escape valve like this so I can still leverage 99% of the great work in livereload-js while still supporting hot reload for my ember apps w/ ember-cli.

Thoughts? Questions? Next Steps?

hotreload

https://github.com/toranb/ember-hot-reload-spike

*keep in mind the above project is a spike to prove out hot reloading with ember-cli

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants