
Security News
Knip Hits 500 Releases with v5.62.0, Improving TypeScript Config Detection and Plugin Integrations
Knip hits 500 releases with v5.62.0, refining TypeScript config detection and updating plugins as monthly npm downloads approach 12M.
Powerful Reactive Framework based on EventEmitter, Signals, and Object Stream Operators
Powerful Reactive Framework based on EventEmitter, Signals, and Object Stream Operators
A minimal, composable, and extensible event-driven programming toolkit for JavaScript/TypeScript environments. This library provides a foundational set of classes and operators for building reactive data flows, signal-based state management, and event emission pipelines, inspired by concepts from RxJS and functional programming.
npm install ladybits
Or simply copy the source file into your project.
import { EventEmitter } from 'ladybits';
const emitter = new EventEmitter();
const unsubscribe = emitter.on('event', (data) => {
console.log('Received:', data);
});
emitter.emit('event', { message: 'Hello World' });
unsubscribe(); // Remove the subscriber
import { ReactiveEmitter } from 'ladybits';
const stream = new ReactiveEmitter();
stream
.filter(v => v > 10)
.debounce(300)
.subscribe((value) => {
console.log('Filtered and debounced value:', value);
});
stream.emitValue(5); // No output
stream.emitValue(15); // Output after 300ms: 15
import { ReactiveSignal } from 'ladybits';
const count = new ReactiveSignal(0);
const unsubscribe = count
.scan((acc, n) => acc + n, 0)
.subscribe(val => console.log('Accumulated:', val));
count.value = 1; // Accumulated: 1
count.value = 2; // Accumulated: 3
unsubscribe();
on(event, subscriber)
: Subscribe to an event. Returns an unsubscribe function.off(event, subscriber)
: Unsubscribe from an event.emit(event, data)
: Emit data to all subscribers of an event.terminate()
: Remove all events and subscribers.EventEmitter
.emitValue(value)
: Emit a value on the "value"
event.subscribe(subscriber)
: Subscribe to "value"
events. Returns an unsubscribe function.path
: Array of chained emitters (for introspection).operators
object are attached as instance methods.StreamEmitter
.iterate
, filter
, debounce
, distinctUntilChanged
, scan
, delay
, throttle
, withLatestFrom
, merge
.value
: Getter/setter for the current value (setting calls notify()
).subscribe(subscriber)
: Subscribe to value changes. Returns an unsubscribe function.notify()
: Notifies all current subscribers.id
: Unique identifier for the signal.Signal
.iterate(source)
filter(source, predicate)
debounce(source, ms)
distinctUntilChanged(source, [compareFn])
scan(source, accumulator, seed)
delay(source, ms)
throttle(source, ms)
withLatestFrom(source, other)
merge(...emitters)
Each operator returns a new ReactiveEmitter
instance and can be chained.
Written for educaion, inspired by Signals, Observables, EventEmitter and many functional reactive programming libraries.
FAQs
Powerful Reactive Framework based on EventEmitter, Signals, and Object Stream Operators
The npm package ladybits receives a total of 5 weekly downloads. As such, ladybits popularity was classified as not popular.
We found that ladybits demonstrated a healthy version release cadence and project activity because the last version was released less than 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.
Security News
Knip hits 500 releases with v5.62.0, refining TypeScript config detection and updating plugins as monthly npm downloads approach 12M.
Security News
The EU Cyber Resilience Act is prompting compliance requests that open source maintainers may not be obligated or equipped to handle.
Security News
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.