Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@esmj/observable

Package Overview
Dependencies
Maintainers
0
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@esmj/observable - npm Package Compare versions

Comparing version 0.1.1 to 0.2.1

4

dist/index.d.ts

@@ -29,3 +29,3 @@ interface IObserverFunction {

#private;
pipe(...operations: any[]): any;
pipe<T extends IObservable>(...operations: any[]): T;
next(...rest: any[]): void;

@@ -39,4 +39,4 @@ error(...rest: any[]): void;

}
declare function pipe<T>(...operations: ((operation: T) => T)[]): (any: T) => T;
declare function pipe<T extends IObservable>(...operations: ((operation: T) => T)[]): (any: T) => T;
export { IExtendable, IObservable, IObserver, IObserverFunction, IObserverObject, Observable, Observer, Subscription, pipe };

@@ -36,3 +36,3 @@ var __defProp = Object.defineProperty;

var Observable = class {
#observers = [];
#observers = /* @__PURE__ */ new Set();
pipe(...operations) {

@@ -42,3 +42,3 @@ return pipe(...operations)(this);

next(...rest) {
this.#observers.forEach((observer) => {
Array.from(this.#observers).forEach((observer) => {
typeof observer === "function" ? observer(...rest) : observer.next(...rest);

@@ -48,3 +48,3 @@ });

error(...rest) {
this.#observers.forEach((observer) => {
Array.from(this.#observers).forEach((observer) => {
observer?.error?.(...rest);

@@ -55,3 +55,3 @@ this.unsubscribe(observer);

complete(...rest) {
this.#observers.forEach((observer) => {
Array.from(this.#observers).forEach((observer) => {
observer?.complete?.(...rest);

@@ -62,3 +62,3 @@ this.unsubscribe(observer);

subscribe(observer) {
this.#observers.push(observer);
this.#observers.add(observer);
return {

@@ -71,4 +71,3 @@ unsubscribe: () => {

unsubscribe(observer) {
const index = this.#observers.indexOf(observer);
this.#observers.splice(index, 1);
this.#observers.delete(observer);
}

@@ -75,0 +74,0 @@ };

{
"name": "@esmj/observable",
"version": "0.1.1",
"version": "0.2.1",
"description": "Tiny observable library for other extensibility",

@@ -5,0 +5,0 @@ "keywords": [

@@ -20,3 +20,3 @@ # Observable

```javascript
import { Observable, IObservable, IObserver } from '@esmj/monitor';
import { Observable, IObservable, IObserver } from '@esmj/observable';

@@ -66,2 +66,2 @@ const observer: IObserver = {

##### observer
Type: `() => void | { ?next: () => void, error?: () => void, complete?: () => void}`
Type: `() => void | { ?next: () => void, error?: () => void, complete?: () => void}`

Sorry, the diff of this file is not supported yet

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