Skip to content

Commit

Permalink
Subscribing to startTour service
Browse files Browse the repository at this point in the history
  • Loading branch information
tnicola committed Jul 21, 2018
1 parent 716e8e3 commit 6eb10e4
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/lib/src/services/joyride.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import { JoyrideStepService } from "./joyride-step.service";
import { JoyrideOptionsService } from './joyride-options.service';
import { JoyrideOptions } from '../models/joyride-options.class';
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/operator/do';
import 'rxjs/add/operator/finally';
import { JoyrideStepInfo } from '../models/joyride-step-info.class';

@Injectable()
export class JoyrideService {

private tourInProgress: boolean = false;
private tourSubscription$: Observable<JoyrideStepInfo>;
private tour$: Observable<JoyrideStepInfo>;

constructor(
private readonly stepService: JoyrideStepService,
Expand All @@ -23,9 +23,10 @@ export class JoyrideService {
if (options) {
this.optionsService.setOptions(options);
}
this.tourSubscription$ = this.stepService.startTour().do(() => { }, () => { }, () => this.tourInProgress = false);
this.tour$ = this.stepService.startTour().finally(() => this.tourInProgress = false);
this.tour$.subscribe();
}
return this.tourSubscription$;
return this.tour$;
}

isTourInProgress(): boolean {
Expand Down

0 comments on commit 6eb10e4

Please sign in to comment.