Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@flexbase/observable-subject

Package Overview
Dependencies
Maintainers
4
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@flexbase/observable-subject - npm Package Compare versions

Comparing version
2.0.1
to
2.1.0-beta.20
+1
-6
dist/core/multicast.dispatcher.d.ts
import { SubscriptionDispatcher } from './subscription.dispatcher.js';
import { SubscriptionContext } from './subscription.context.js';
import { SubscriptionCallback } from './subscription.callback.js';
export declare class MulticastDispatcher<T> implements SubscriptionDispatcher<T> {
dispatch(context: SubscriptionContext<T>, callbacks: SubscriptionCallback<T>[]): Promise<void>;
}
/** Represents a global multicast dispatcher instance */
export declare const multicastDispatcher: MulticastDispatcher<unknown>;
export declare const multicastDispatcher: SubscriptionDispatcher;
+1
-1

@@ -19,3 +19,3 @@ import { Logger } from '@flexbase/logger';

*/
register(subject: Subject, dispatcher?: SubscriptionDispatcher<unknown>): boolean;
register(subject: Subject, dispatcher?: SubscriptionDispatcher): boolean;
/**

@@ -22,0 +22,0 @@ * Checks if a subject is registered with this manager

import { SubscriptionContext } from './subscription.context.js';
/** Represents a subscription callback method */
export type SubscriptionCallback<T> = (context: SubscriptionContext<T>) => Promise<void>;
/**
* Represents a subscription callback method
* @param context - The context of the subscription notification
*/
export type SubscriptionCallback<T> = (context: SubscriptionContext<T>) => Promise<void> | void;

@@ -1,5 +0,7 @@

/** Represents the context sent to subscriptions on a notification */
export interface SubscriptionContext<T> {
/** The value of the context */
/**
* Represents the context sent to subscriptions on a notification
*/
export type SubscriptionContext<T> = {
/** The value of the subscription context */
value: Readonly<T>;
}
};
import { SubscriptionCallback } from './subscription.callback.js';
import { SubscriptionContext } from './subscription.context.js';
/** Represents a subscription dispatcher */
export interface SubscriptionDispatcher<T> {
/**
* Handles dispatching the subscription callbacks
* @param context The context sent to each subscription
* @param callbacks The subscription callbacks that are to be notified
*/
dispatch(context: SubscriptionContext<T>, callbacks: SubscriptionCallback<T>[]): Promise<void>;
}
export type SubscriptionDispatcher =
/**
* Handles dispatching the subscription callbacks
* @param context The context sent to each subscription
* @param callbacks The subscription callbacks that are to be notified
*/
<T>(context: SubscriptionContext<T>, callbacks: SubscriptionCallback<T>[]) => Promise<void>;

@@ -6,3 +6,3 @@ export { Subject } from './core/subject.interface.js';

export { SubscriptionDispatcher } from './core/subscription.dispatcher.js';
export { multicastDispatcher, MulticastDispatcher } from './core/multicast.dispatcher.js';
export { multicastDispatcher } from './core/multicast.dispatcher.js';
export { SubscriptionCallback } from './core/subscription.callback.js';

@@ -15,10 +15,6 @@ var a = Object.defineProperty;

}
const p = new g();
const p = new g(), l = async (i, e) => {
await Promise.allSettled(e.map((s) => s(i)));
};
class h {
async dispatch(e, s) {
await Promise.allSettled(s.map((t) => t(e)));
}
}
const l = new h();
class y {
constructor(e, s) {

@@ -40,3 +36,3 @@ o(this, "_subscription");

}
class k {
class y {
constructor(e) {

@@ -77,2 +73,3 @@ o(this, "_logger");

}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
_subscribe(e, s) {

@@ -88,3 +85,3 @@ var n;

}
}, r = new y(c, s);
}, r = new h(c, s);
return t.subscriptions.push(r), r.subscription;

@@ -147,12 +144,11 @@ }

const c = t.subscriptions.map((n) => n.callback);
await t.dispatcher.dispatch(s, c);
await t.dispatcher(s, c);
}
}
const S = new k();
const _ = new y();
export {
h as MulticastDispatcher,
k as SubjectManager,
y as SubjectManager,
l as multicastDispatcher,
p as noopSubscription,
S as subjectManager
_ as subjectManager
};
{
"name": "@flexbase/observable-subject",
"version": "2.0.1",
"version": "2.1.0-beta.20",
"description": "Observable subject event bus",

@@ -21,5 +21,14 @@ "main": "./dist/index.js",

"license": "MIT",
"dependencies": { "@flexbase/logger": "^1.4.3" },
"dependencies": {
"@flexbase/logger": "^1.4.3"
},
"type": "module",
"keywords": ["flexbase", "observable", "subject", "event-bus", "event", "bus"]
"keywords": [
"flexbase",
"observable",
"subject",
"event-bus",
"event",
"bus"
]
}