page visibility api implemented in angular service