Skip to content
Snippets Groups Projects
Commit 43912a30 authored by jojohoch's avatar jojohoch
Browse files

[player] Unsubscribe section from media change events after it's visible

parent 30632cbf
No related branches found
No related tags found
No related merge requests found
import { Directive, ElementRef, Input } from '@angular/core'; import { Directive, ElementRef, Input } from '@angular/core';
import { delay, Subject } from 'rxjs'; import { delay, Subject, Subscription } from 'rxjs';
import { Section } from 'common/models/section'; import { Section } from 'common/models/section';
import { takeUntil } from 'rxjs/operators'; import { takeUntil } from 'rxjs/operators';
import { ElementCodeStatusValue } from 'player/modules/verona/models/verona'; import { ElementCodeStatusValue } from 'player/modules/verona/models/verona';
...@@ -28,7 +28,11 @@ export class SectionVisibilityHandlingDirective { ...@@ -28,7 +28,11 @@ export class SectionVisibilityHandlingDirective {
.pipe( .pipe(
takeUntil(this.ngUnsubscribe), takeUntil(this.ngUnsubscribe),
delay(this.section.activeAfterIdDelay)) delay(this.section.activeAfterIdDelay))
.subscribe((id: string): void => this.setActiveAfterID(id)); .subscribe((id: string): void => {
this.ngUnsubscribe.next();
this.ngUnsubscribe.complete();
this.setActiveAfterID(id);
});
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment