Update tests

This commit is contained in:
Philip Bjorge
2016-01-19 21:54:58 -08:00
parent bcebb6e7e6
commit ae814b634b
2 changed files with 33 additions and 19 deletions
+31 -17
View File
@@ -1,23 +1,37 @@
/// <reference path="./angular-idle.d.ts" />
angular.module('app', ['ngIdle'])
.config(['$keepaliveProvider', '$idleProvider',
($keepaliveProvider: ng.idle.IKeepAliveProvider, $idleProvider: ng.idle.IIdleProvider) => {
$idleProvider.activeOn('mousemove keydown DOMMouseScroll mousewheel mousedown');
$idleProvider.idleDuration(5);
$idleProvider.warningDuration(5);
$idleProvider.keepalive(true)
$idleProvider.autoResume(true);
$keepaliveProvider.interval(10);
.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.watch();
if ($idle.running() || $idle.idling()) {
$idle.unwatch();
.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();
Keepalive.start();
Keepalive.ping();
Keepalive.stop();
}]);
+2 -2
View File
@@ -123,13 +123,13 @@ declare module angular.idle {
* Updates the idle value (see IdleProvider.idle()) and
* restarts the watch if its running.
*/
setIdle(): void;
setIdle(idle: number): void;
/**
* Updates the timeout value (see IdleProvider.timeout()) and
* restarts the watch if its running.
*/
setTimeout(): void;
setTimeout(timeout: number): void;
/**
* Whether user has timed out (meaning idleDuration + timeout has passed without any activity)