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

@esmj/observable

Package Overview
Dependencies
Maintainers
1
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

to
0.1.0

12

dist/index.d.ts

@@ -11,2 +11,6 @@ interface IObserverFunction {

type IObserver = IObserverObject | IObserverFunction;
type Subscription = {
unsubscribe: () => void;
[props: string]: unknown;
};
interface IObservable {

@@ -17,3 +21,3 @@ pipe<T extends IObservable>(...operations: ((operation: T) => T)[]): T;

complete(...rest: unknown[]): void;
subscribe(observer: IObserver): () => void;
subscribe(observer: IObserver): Subscription;
unsubscribe(observer: IObserver): void;

@@ -32,6 +36,8 @@ }

complete(...rest: any[]): void;
subscribe(observer: IObserver): () => void;
subscribe(observer: IObserver): {
unsubscribe: () => void;
};
unsubscribe(observer: IObserver): void;
}
export { IObservable, IObserver, IObserverFunction, IObserverObject, Observable, Observer };
export { IObservable, IObserver, IObserverFunction, IObserverObject, Observable, Observer, Subscription };

@@ -61,4 +61,6 @@ var __defProp = Object.defineProperty;

this.#observers.push(observer);
return () => {
this.unsubscribe(observer);
return {
unsubscribe: () => {
this.unsubscribe(observer);
}
};

@@ -65,0 +67,0 @@ }

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

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

@@ -30,3 +30,3 @@ # Observable

const unsubscribe = observable.subscribe(observer);
const { unsubscribe } = observable.subscribe(observer);

@@ -57,3 +57,3 @@ observable.next('Hello world'); // log: Hello world

Returns an unsubscribe method.
Returns an subscription object with unsubscribe method.

@@ -60,0 +60,0 @@ ##### observer

Sorry, the diff of this file is not supported yet