mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-08-30 11:14:27 +08:00
37 lines
1.1 KiB
TypeScript
37 lines
1.1 KiB
TypeScript
/// <reference path="./angular-idle.d.ts" />
|
|
|
|
angular.module('app', ['ngIdle'])
|
|
.config(['KeepaliveProvider', 'IdleProvider',
|
|
(keepaliveProvider: ng.idle.IKeepAliveProvider, idleProvider: ng.idle.IIdleProvider) => {
|
|
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);
|
|
}])
|
|
.run(['Keepalive', 'Idle', (Keepalive: ng.idle.IKeepAliveService, Idle: ng.idle.IIdleService) => {
|
|
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();
|
|
}]); |