import { Subject } from 'rxjs' ; export class ActionCompleter { cancelUncompleted$ = new Subject < void > ( ) ; cancelPreviousAction ( ) { this . cancelUncompleted$ . next ( ) ; } } export function createActionCompleter ( cancelUncompleted ) { return cancelUncompleted ? new ActionCompleter ( ) : null ; }