import { Observable , Subject } from 'rxjs' ; import { debounceTime , distinctUntilChanged } from 'rxjs/operators' ; export class HeroSearchPresenter { private searchTerms : Subject < string > = new Subject ( ) ; searchTerms$ : Observable < string > = this . searchTerms . pipe ( debounceTime ( 300 ) , distinctUntilChanged ( ) ) ; search ( term ) { this . searchTerms . next ( term ) ; } }