diff --git a/app/scripts/services/access-token.js b/app/scripts/services/access-token.js index 686de0a..b6ffc7e 100644 --- a/app/scripts/services/access-token.js +++ b/app/scripts/services/access-token.js @@ -2,7 +2,7 @@ var accessTokenService = angular.module('oauth.accessToken', ['ngStorage']); -accessTokenService.factory('AccessToken', function($rootScope, $location, $sessionStorage, $timeout){ +accessTokenService.factory('AccessToken', function($rootScope, $location, $sessionStorage, $interval){ var service = { token: null @@ -144,9 +144,9 @@ accessTokenService.factory('AccessToken', function($rootScope, $location, $sessi var setExpiresAtEvent = function(){ var time = (new Date(service.token.expires_at))-(new Date()); if(time){ - $timeout(function(){ + $interval(function(){ $rootScope.$broadcast('oauth:expired', service.token) - }, time) + }, time, 1) } }; diff --git a/dist/oauth-ng.js b/dist/oauth-ng.js index 84f02c5..3182e8c 100644 --- a/dist/oauth-ng.js +++ b/dist/oauth-ng.js @@ -20,7 +20,7 @@ angular.module('oauth').config(['$locationProvider','$httpProvider', var accessTokenService = angular.module('oauth.accessToken', ['ngStorage']); -accessTokenService.factory('AccessToken', function($rootScope, $location, $sessionStorage, $timeout){ +accessTokenService.factory('AccessToken', function($rootScope, $location, $sessionStorage, $interval){ var service = { token: null @@ -162,9 +162,9 @@ accessTokenService.factory('AccessToken', function($rootScope, $location, $sessi var setExpiresAtEvent = function(){ var time = (new Date(service.token.expires_at))-(new Date()); if(time){ - $timeout(function(){ + $interval(function(){ $rootScope.$broadcast('oauth:expired', service.token) - }, time) + }, time, 1) } };