Feature to detect visibility

Is the API fine this way?
Should I make gameloop stop to call onRender when the canvas is not visible?