Socket
Book a DemoInstallSign in
Socket

ai-subject

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ai-subject

Send values to an async iterable like Reactive Extensions does

1.0.0
latest
Source
npmnpm
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

ai-subject

npm Gitlab pipeline status

Send values to an async iterable like Reactive Extensions does. This multicasts values to be multicasted to many listeners. The listener would be anything that retrieves an iterator via the [Symbol.asyncIterator]() method. Subjects are like EventEmitters.

Usage

import { AiSubject } from "ai-subject"

const aiSubject = new AiSubject()

Creates a new instance of AiSubject.

aiSubject[Symbol.asyncIterator]()

Listens to the subject until it finishes.

Returns:

  • AsyncIterable & AsyncIterator - An iterator that listens to values sent to the subject.

Note: The subject will only emit values sent via onNext if the iterator is listened to.

aiSubject.onNext(value)

Sends a new value to all of the subject's listeners.

Parameters:

  • value - The value

aiSubject.onEnd()

Ends the subject.

aiSubject.onError(error)

Transitions the subject to an error state.

Parameters:

  • error - The error.

Keywords

subject

FAQs

Package last updated on 01 Feb 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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.