Skip to content
This repository has been archived by the owner on Sep 19, 2024. It is now read-only.
janek42 edited this page Jul 24, 2022 · 14 revisions

Overview

Two principal services are provided: Keepalive and Idle. Each has a provider that can be used to configure options. They both communicate with the angular application through events on the root scope.

Keepalive Service

Keepalive is used to periodically broadcast the Keepalive event on the root scope. You can listen on this event and respond however you like. Usually, you'd make an HTTP request to some endpoint to keep the user's session alive. As such, it can be configured to make an $http request for you.

Read the documentation for Keepalive and KeepaliveProvider

Idle Service

Idle is used to watch for user events to bubble up to document.body. Once you start watching for idleness, a timeout will start. If that timeout expires, it will broadcast the IdleStart event on the root scope and enter the warning phase. During the warning phase, the IdleWarn event will be broadcast every second, counting down to zero. When the countdown hits zero, the IdleTimeout event is broadcast, indicating the user's session has expired. If at any time the user triggers a watched event, it will reset the idle and warning timeouts and states and broadcast the IdleEnd event on the root scope. If the user keeps clicking, scrolling, etc. within the idle duration, they can ostensibly stay logged in forever.

Read the documentation for Idle and IdleProvider

Title Service (new in v1.0.0)

Title is a service used to track and update the title. Specifically, it is used to remember the original title and display an idle warning message (that can be updated on a countdown) or the timed out message. It is used by the title directive to watch for IdleWarn, IdleEnd and IdleTimedout events broadcast on the root scope by Idle. You can also use it to change titles programmatically for other purposes, if you wish.

Read the documentation for Title

These services may be used independently.

Migrating to 1.0.0 from 0.x

With the release of version 1.0.0, several large and breaking changes were introduced. This guide will detail the changes you need to make so your application will work again.