Skip to content

Commit

Permalink
refactor(focus-origin-monitor): complete stream when stopping monitor (
Browse files Browse the repository at this point in the history
  • Loading branch information
crisbeto authored and kara committed Mar 4, 2017
1 parent 63d4359 commit 94adecd
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/lib/core/style/focus-origin-monitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,15 @@ export class FocusOriginMonitor {
* @param element The element to stop monitoring.
*/
unmonitor(element: Element): void {
if (!this._elementInfo.has(element)) {
return;
let elementInfo = this._elementInfo.get(element);

if (elementInfo) {
elementInfo.unlisten();
elementInfo.subject.complete();

this._setClasses(element, null);
this._elementInfo.delete(element);
}
this._elementInfo.get(element).unlisten();
this._setClasses(element, null);
this._elementInfo.delete(element);
}

/**
Expand Down

0 comments on commit 94adecd

Please sign in to comment.