-
Notifications
You must be signed in to change notification settings - Fork 3
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
Change Listener Not Working #121
Comments
Not that I would be aware of. Can you provide a bit more context? Does the Also why would you reload the page on a change event in store? |
I'm using: hoodie.store.on('change', refresh); With the understanding that if my couchDB changed the refresh method would be called. Is the right way? And for context, the app i'm implementing has 2 sides, a customer facing and back end, when a change is made on either i.e. someone logs in or out there should a refresh to ensure the new data is displayed. |
Ideally you would update the HTML dynamically if changes occur, instead of reloading the page. I could imagine that the If you need to do the reload, can you try putting in a delay, like this? hoodie.store.on('change', refresh);
var timeout
function refresh() {
clearTimeout(timeout)
timeout = setTimeout(location.reload.bind(location), 300)
} That code will reload the page 300ms after the last change event |
That helps. In addition I think i found the underlying issue, there was a location.reload() being executed which i believe was stopping the JS from doing what it does as you state. Will continue testing. |
Thanks, glad to hear you make progress. Feel free to close this issue and open new ones as they arise |
Hello,
I'm find at times the following change listener does not work.
As this been reported/observed already?
Thanks.
The text was updated successfully, but these errors were encountered: