forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
angular-idle-tests.ts
53 lines (44 loc) · 1.53 KB
/
angular-idle-tests.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/// <reference path="./angular-idle.d.ts" />
angular.module('app', ['ngIdle'])
.config(['KeepaliveProvider', 'IdleProvider', 'TitleProvider',
(keepaliveProvider: angular.idle.IKeepAliveProvider, idleProvider: angular.idle.IIdleProvider,
titleProvider: angular.idle.ITitleProvider) => {
idleProvider.interrupt('mousemove keydown DOMMouseScroll mousewheel mousedown');
idleProvider.idle(5);
idleProvider.timeout(5);
idleProvider.keepalive(true)
idleProvider.autoResume(true);
const config: ng.IRequestConfig = {
url: "http://google.com",
method: "GET"
};
keepaliveProvider.http(config.url); // should accept string and ng.IRequestConfig
keepaliveProvider.http(config);
keepaliveProvider.interval(10);
titleProvider.enabled(true);
}])
.run(['Keepalive', 'Idle', 'Title', (Keepalive: angular.idle.IKeepAliveService, Idle: angular.idle.IIdleService,
Title: angular.idle.ITitleService) => {
Idle.setTimeout(Idle.getTimeout());
Idle.setIdle(Idle.getIdle());
Idle.watch();
Idle.interrupt();
const expired: boolean = Idle.isExpired();
if (Idle.running() || Idle.idling()) {
Idle.unwatch();
}
Keepalive.start();
Keepalive.ping();
Keepalive.stop();
Keepalive.setInterval(10);
Title.setEnabled(Title.isEnabled());
Title.original(Title.original());
Title.value(Title.value());
Title.store(false);
Title.store();
Title.restore();
Title.idleMessage(Title.idleMessage());
Title.timedOutMessage(Title.timedOutMessage());
Title.setAsIdle(120);
Title.setAsTimedOut();
}]);