This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

@saferx/callable-subject
TypeScript icon, indicating that this package has built-in type declarations

0.2.1 • Public • Published

Callable Subject

npm version

Subjects that can be called:

  • CallableSubject
  • CallableReplaySubject
  • CallableAsyncSubject
  • CallableBehaviorSubject

Rather, like a Subject. Is not a true extension of the Subject.

Accessible methods: pipe, subscribe, complete, next and source$ (source Subject)

Other "safe" extensions and utilities for RxJS

Installation

npm i @saferx/callable-subject

Usage

import { CallableSubject } from "@saferx/callable-subject";

const callableSubject = new CallableSubject<number>();

callableSubject(7); // the same as callableSubject.next(7)
callableSubject.pipe(map((v) => v + 1)).subscribe((v) => console.log(v)); // logs: 8

Best practices

  • Better to pass an object to know the names of the parameters:

    const loadUser = new CallableSubject<{ id: number }>();
    // clearer than
    const loadUser = new CallableSubject<number>(); // here it is not clear what is the argument "number"

Package Sidebar

Install

npm i @saferx/callable-subject

Weekly Downloads

3

Version

0.2.1

License

MIT

Unpacked Size

12.7 kB

Total Files

14

Last publish

Collaborators

  • krickray