Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
event-publisher
Advanced tools
A strongly typed protected event creator/publisher/signaler for use with TypeScript and JavaScript.
A strongly typed protected event creator/publisher/signaler for use with TypeScript and JavaScript.
import { Event, EventPublisher } from '../src/EventPublisher';
export class MyObservable<T> {
readonly start:Event<void>;
readonly update:Event<T>;
readonly complete:Event<void>;
private readonly _dispatcher:{
start:EventPublisher<void>,
update:EventPublisher<T>,
complete:EventPublisher<void>
};
constructor()
{
const start = new EventPublisher<void>();
const update = new EventPublisher<T>();
const complete = new EventPublisher<void>();
this._dispatcher = { start, update, complete };
this.start = start.event;
this.update = update.event;
this.complete = complete.event;
}
}
type Listener<T> = (value: T) => void;
type Unsubscribe = () => void;
interface Event<T>
{
/**
* Adds a listener and return an unsubscribe function.
* @param listener
*/
(listener: Listener<T>): Unsubscribe;
/**
* Add an entry to the end of the registry.
* @param value
*/
add(value: T): number;
/**
* Remove an entry.
* @param id
*/
remove(id: number): boolean;
/**
* Adds an entry to the registry if it doesn't exist.
* @param value
*/
register(value: T): number;
/**
* Clears all entries.
*/
clear(): void;
}
interface IEventPublisher<T>
{
publish(payload: T): void;
publishReverse(payload: T): void;
readonly event: Readonly<Event<T>>;
}
FAQs
A strongly typed protected event creator/publisher/signaler for use with TypeScript and JavaScript.
The npm package event-publisher receives a total of 2 weekly downloads. As such, event-publisher popularity was classified as not popular.
We found that event-publisher demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.