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

Fire an event before reloading #82

Open
joankaradimov opened this issue Mar 20, 2019 · 3 comments
Open

Fire an event before reloading #82

joankaradimov opened this issue Mar 20, 2019 · 3 comments

Comments

@joankaradimov
Copy link

The LiveReload object receives LiveReloadConnect/LiveReloadDisconnect events. Would it be possible/reasonable to trigger a LiveReloadBeforeReload event (or something similar) before the actual reloading is done? This will allow to distinguish between user initiated navigation and the reloading done by livereload-js.

@smhg
Copy link
Contributor

smhg commented Mar 22, 2019

You mean document receives these events, right? To avoid confusion.
Firing a LiveReloadReload event from a reload event before the reloader sounds reasonable.

@joankaradimov
Copy link
Author

You mean document receives these events, right?

You are right, yes. The LiveReload object actually receives connect/disconnect and then fires LiveReloadConnect/LiveReloadDisconnect on the document.

Firing a LiveReloadReload event from a reload event before the reloader sounds reasonable.

So adding this line in performReload would be ok:

CustomEvents.fire(document, 'LiveReloadReload');

Should I open a pull request or can someone else implement this? Also - does this require a test?

@smhg
Copy link
Contributor

smhg commented Mar 22, 2019

A PR would definitely be appreciated, thanks!
There seem to be no mocha tests for this functionality. So let's add them, however basic.

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

No branches or pull requests

2 participants