Dataview auto-refreshing view
We add an Observer on the Dataview container, which let’s us know when it goes in and out of view.
If it’s out of view we cancel the interval, and when it comes back into view we start a new interval.
Put this with your Dataview scripts, called refresh.js
:
And then call it from any page like this:
You can see from the console that it will immediately cancel and resume as you change between different notes or the Source and Reading etc views.
You can even call another dv.view(...)
from within the refresh block, which makes it pretty unlimited what you can have automatically updating: