UNPKG

observable-callback

Version:

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

7 lines (6 loc) 221 B
import { Subject } from "rxjs"; const pass = (input$) => input$; export function observableCallback(operator = pass) { const subject = new Subject(); return [subject.pipe(operator), (arg) => subject.next(arg)]; }