Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public runGetAccessjwtTokenSheduler() {
- this.getAccessTokenIntervalId =
- setInterval(() => {this.updateAccessjwtToken().subscribe()},
- AccessTokenLifeTime - 5000);
- }
- Uncaught SyntaxError: Unexpected identifier
- const AccessTokenLifeTime = 15000;
- @Injectable()
- export class SchedulerService {
- private static _authService: AuthorizationService = null;
- private static AccessTokenTimer: any;
- constructor(private authService: AuthorizationService) {
- SchedulerService._authService = authService;
- }
- public static stopUpdateAccessJwtTokenLoop() {
- clearInterval(SchedulerService.AccessTokenTimer);
- }
- public static runUpdateAccessJwtTokenLoop() {
- SchedulerService.AccessTokenTimer = setInterval(() => {
- console.log("Update access Jwt token loop is working.");
- if (AuthorizationService.isAuthorized && SchedulerService._authService != null) {
- SchedulerService._authService.updateAccessjwtToken().subscribe();
- }
- }, AccessTokenLifeTime - 5000);
- }
- }
- var source = Rx.Observable
- .interval(500 /* ms */)
- .timeInterval();
- var subscription = source.subscribe(
- function (x) {
- console.log('Next: ' + x);
- },
- function (err) {
- console.log('Error: ' + err);
- },
- function () {
- console.log('Completed');
- });
- // => Next: {value: 0, interval: 500}
- // => Next: {value: 1, interval: 500}
- // => Next: {value: 2, interval: 500}
- // => Completed
Add Comment
Please, Sign In to add comment