UNPKG

oidc-client-rx

Version:

ReactiveX enhanced OIDC and OAuth2 protocol support for browser-based JavaScript applications

31 lines (30 loc) 1.3 kB
import { Injectable } from "injection-js"; import { interval } from "rxjs"; function _ts_decorate(decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc); else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; } class IntervalService { isTokenValidationRunning() { return Boolean(this.runTokenValidationRunning); } stopPeriodicTokenCheck() { if (this.runTokenValidationRunning) { this.runTokenValidationRunning.unsubscribe(); this.runTokenValidationRunning = null; } } startPeriodicTokenCheck(repeatAfterSeconds) { const millisecondsDelayBetweenTokenCheck = 1000 * repeatAfterSeconds; return interval(millisecondsDelayBetweenTokenCheck); } constructor(){ this.runTokenValidationRunning = null; } } IntervalService = _ts_decorate([ Injectable() ], IntervalService); export { IntervalService };