UNPKG

observable-callback

Version:

A small utility for simplified creation of callback functions that publishes the argument to an observable stream when called.

8 lines (7 loc) 296 B
import { Subject } from "rxjs"; var pass = function (input$) { return input$; }; export function observableCallback(operator) { if (operator === void 0) { operator = pass; } var subject = new Subject(); return [subject.pipe(operator), function (arg) { return subject.next(arg); }]; }