sophiathekitty / NullHub

a custom home automation hub i'm building to handle automating wemo outlets and coordinating a handful of other raspberry pi based diy devices.
MIT License
1 stars 0 forks source link

centralized view refreshing #24

Open sophiathekitty opened 2 years ago

sophiathekitty commented 2 years ago

i think i should probably see about creating some refresh loops that can be used to refresh the data in different views.

sophiathekitty commented 2 years ago

the clock loop could technically be the only interval... and the views could register as ever_minute, every_five_minute, every_ten_minutes, or every_hour... basically like the cronjobs... have them happen at like the mid point of the minute....

sophiathekitty commented 1 year ago

Use the jQuery :visible Selector to avoid refreshing stuff that isn't visible and add some sort of hooks for having views update when switching sections or room details

if($("p").is(":visible")){
    alert("The paragraph  is visible.");
} else{
    alert("The paragraph  is hidden.");
}
sophiathekitty commented 1 year ago

use these to detect when window is focused and blurred

$(window).on('focus', function() { // your code });
$(window).on('blur', function() { // your code });

could maybe also use

$(window).focus(()=>{});
$(window).blur(()=>{});