I have a dataset connected to a repeater to list out information from a specific collection.
Is it possible to create a "polling interrupt" type behavior where if any new information is added to the collection, whether this be from another session somewhere else, the information displayed in the repeater is updated to match.
So like say maybe every 10 seconds the dataset is refetched.
is this possible?
You can pause the refresh when the input element is in focus and restart it when the focus is removed.
var paused = false; $w.onReady( function() { //onFocus $w("#myElement").onFocus( (event) => { paused = true; }); //onBlur $w("#myElement").onBlur( (event) => { paused = false; }); //timer setInterval( () => { if(paused === false) { $w("#dataset1").refresh(); } }, 10000); });
Use setInterval
$w.onReady( function() { setInterval( () => { $w("#dataset1").refresh(); }, 10000); //10000 milliseconds which is 10 seconds });