I want to spare browsers from unnecessarily acquiring resources when my web page is shown in a non-active tab or hidden by another program window (= inactive).
Which events to I need to subscribe to in order to recognize when my web page is (in)active, or (in)visible?