nope-js-browser
Version:
NoPE Runtime for the Browser. For nodejs please use nope-js-node
21 lines (20 loc) • 535 B
JavaScript
/**
* @author Martin Karkowski
* @email m.karkowski@zema.de
*/
import { BehaviorSubject, ReplaySubject, Subject } from "rxjs";
/**
* Helper to define the correct RXJS Subject based on the options (see {@link TSubjectOptions})
*
* @author M.Karkowski
* @return {*}
*/
export function getSubject(options = {}) {
if (options.showCurrent) {
if (options.playHistory) {
return new ReplaySubject();
}
return new BehaviorSubject(undefined);
}
return new Subject();
}