Guest User

Untitled

a guest
Feb 18th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. public runGetAccessjwtTokenSheduler() {
  2. this.getAccessTokenIntervalId =
  3. setInterval(() => {this.updateAccessjwtToken().subscribe()},
  4. AccessTokenLifeTime - 5000);
  5. }
  6.  
  7. Uncaught SyntaxError: Unexpected identifier
  8.  
  9. const AccessTokenLifeTime = 15000;
  10.  
  11. @Injectable()
  12. export class SchedulerService {
  13.  
  14. private static _authService: AuthorizationService = null;
  15.  
  16. private static AccessTokenTimer: any;
  17.  
  18. constructor(private authService: AuthorizationService) {
  19. SchedulerService._authService = authService;
  20. }
  21.  
  22. public static stopUpdateAccessJwtTokenLoop() {
  23. clearInterval(SchedulerService.AccessTokenTimer);
  24. }
  25.  
  26. public static runUpdateAccessJwtTokenLoop() {
  27. SchedulerService.AccessTokenTimer = setInterval(() => {
  28. console.log("Update access Jwt token loop is working.");
  29. if (AuthorizationService.isAuthorized && SchedulerService._authService != null) {
  30. SchedulerService._authService.updateAccessjwtToken().subscribe();
  31. }
  32. }, AccessTokenLifeTime - 5000);
  33. }
  34. }
  35.  
  36. var source = Rx.Observable
  37. .interval(500 /* ms */)
  38. .timeInterval();
  39.  
  40. var subscription = source.subscribe(
  41. function (x) {
  42. console.log('Next: ' + x);
  43. },
  44. function (err) {
  45. console.log('Error: ' + err);
  46. },
  47. function () {
  48. console.log('Completed');
  49. });
  50.  
  51. // => Next: {value: 0, interval: 500}
  52. // => Next: {value: 1, interval: 500}
  53. // => Next: {value: 2, interval: 500}
  54. // => Completed
Add Comment
Please, Sign In to add comment