Skip to content
This repository has been archived by the owner on Sep 19, 2024. It is now read-only.

Commit

Permalink
Merge branch 'release/1.2.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
grbsk committed Apr 23, 2016
2 parents ac5f51d + 6d440e8 commit 3e1bcc0
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 13 deletions.
8 changes: 4 additions & 4 deletions angular-idle.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*** Directives and services for responding to idle users in AngularJS
* @author Mike Grabski <me@mikegrabski.com>
* @version v1.2.0
* @version v1.2.1
* @link https://github.com/HackedByChinese/ng-idle.git
* @license MIT
*/
Expand Down Expand Up @@ -151,9 +151,10 @@ angular.module('ngIdle.idle', ['ngIdle.keepalive', 'ngIdle.localStorage'])

function toggleState() {
state.idling = !state.idling;
var name = state.idling ? 'Start' : 'End';
var name = state.idling ? 'IdleStart' : 'IdleEnd';

if (state.idling) {
$rootScope.$broadcast(name);
stopKeepalive();
if (options.timeout) {
state.countdown = options.timeout;
Expand All @@ -162,10 +163,9 @@ angular.module('ngIdle.idle', ['ngIdle.keepalive', 'ngIdle.localStorage'])
}
} else {
startKeepalive();
$rootScope.$broadcast(name);
}

$rootScope.$broadcast('Idle' + name);

$interval.cancel(state.idle);
}

Expand Down
2 changes: 1 addition & 1 deletion angular-idle.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions angular-idle.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ng-idle",
"version": "1.2.0",
"version": "1.2.1",
"homepage": "https://github.com/HackedByChinese/ng-idle",
"description": "Responding to idle users in AngularJS",
"main": "angular-idle.js",
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ng-idle",
"version": "1.2.0",
"version": "1.2.1",
"description": "Directives and services for responding to idle users in AngularJS",
"keywords": [
"angularjs",
Expand All @@ -12,7 +12,7 @@
"user",
"session"
],
"main": "angular-idle.js",
"main": "index.js",
"scripts": {
"test": "grunt test"
},
Expand Down
6 changes: 3 additions & 3 deletions src/idle/idle.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,10 @@ angular.module('ngIdle.idle', ['ngIdle.keepalive', 'ngIdle.localStorage'])

function toggleState() {
state.idling = !state.idling;
var name = state.idling ? 'Start' : 'End';
var name = state.idling ? 'IdleStart' : 'IdleEnd';

if (state.idling) {
$rootScope.$broadcast(name);
stopKeepalive();
if (options.timeout) {
state.countdown = options.timeout;
Expand All @@ -82,10 +83,9 @@ angular.module('ngIdle.idle', ['ngIdle.keepalive', 'ngIdle.localStorage'])
}
} else {
startKeepalive();
$rootScope.$broadcast(name);
}

$rootScope.$broadcast('Idle' + name);

$interval.cancel(state.idle);
}

Expand Down
12 changes: 12 additions & 0 deletions src/idle/idle.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,18 @@ describe('ngIdle', function() {
expect(Keepalive.stop).toHaveBeenCalled();
});

it('should broadcast IdleStart then IdleWarn', function() {
spyOn($rootScope, '$broadcast');

Idle.watch();

$interval.flush(DEFAULTIDLEDURATION);
$rootScope.$digest();

expect($rootScope.$broadcast).toHaveBeenCalledWith('IdleStart');
expect($rootScope.$broadcast.mostRecentCall.args[0]).toBe('IdleWarn');
});

it('should broadcast IdleEnd, start keepalive and ping', function() {
spyOn($rootScope, '$broadcast');

Expand Down

0 comments on commit 3e1bcc0

Please sign in to comment.