New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

callbag-subject

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

callbag-subject

A callbag listener sink which is also a listenable source

  • 2.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

callbag-subject

A callbag listener sink which is also a listenable source, and maintains an internal list of listeners. Use this like you would use RxJS Subject.

npm install callbag-subject

example

First call makeSubject to create a subject which is then a normal callbag, so:

  • Call it with args (1, data) to send data into the subject
  • Call it with args (2, err) to send an error into the subject
  • Call it with args (2) to make the subject complete
const observe = require('callbag-observe');
const makeSubject = require('callbag-subject');

const subject = makeSubject();

setInterval(() => { subject(1, 'a'); }, 1000);

// First observer is added immediately
observe(x => console.log(x + 1))(subject);

// First observer is added after 2.5 seconds
setTimeout(() => {
  observe(x => console.log(x + 2))(subject);
}, 2500);

// a1
// a1
// a1
// a2
// a1
// a2
// ...

Keywords

FAQs

Package last updated on 20 Nov 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc