npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@synet/event

v1.0.0

Published

Consciousness-based event architecture for SYNET Units. Events that Units can teach and learn.

Readme

@synet/event

  ______               _     _    _       _ _   
 |  ____|             | |   | |  | |     (_) |  
 | |____   _____ _ __ | |_  | |  | |_ __  _| |_ 
 |  __\ \ / / _ \ '_ \| __| | |  | | '_ \| | __|
 | |___\ V /  __/ | | | |_  | |__| | | | | | |_ 
 |______\_/ \___|_| |_|\__|  \____/|_| |_|_|\__|
                                                
                                                
version: 1.0.0                                                

Consciousness-based event-emitter unit

Event handling that Units can teach and learn. Built on Unit Architecture principles with multi-provider flexibility.

Installation

npm install @synet/event

Quick Start

import { Emitter, EventEmitter } from '@synet/event';

// Provider patterns (FS-style)
const events = Emitter.memory<MyEvent>();     // Zero dependencies
const events = Emitter.node<MyEvent>();       // Node.js performance  
const events = Emitter.unit<MyEvent>();       // Unit Architecture

// Type-safe events
interface UserEvent extends Event {
  type: 'user.login' | 'user.logout';
  userId: string;
}

const userEvents = EventEmitter.create<UserEvent>({ provider: 'node' });

const unsubscribe = userEvents.on('user.login', (event) => {
  console.log(`User ${event.userId} logged in`);
});

userEvents.emit({ type: 'user.login', userId: 'alice' });

Unit Architecture

Units can teach event capabilities to other Units:

const eventUnit = EventEmitter.create({ provider: 'memory' });

// Teach event capabilities
otherUnit.learn([eventUnit.teach()]);

// Learned unit can now handle events
otherUnit.execute('event.on', 'workflow.complete', (event) => {
  console.log('Workflow finished:', event);
});

otherUnit.execute('event.emit', { type: 'workflow.complete', result: 'success' });

Providers

  • memory - Custom implementation, works everywhere (browser, Node.js, Deno)
  • node - Wraps Node.js EventEmitter for maximum performance
// Environment-specific optimization
const events = process.env.NODE_ENV === 'production' 
  ? Emitter.node<MyEvent>()
  : Emitter.memory<MyEvent>();

API

Core Interface

interface IEventEmitter<TEvent extends Event = Event> {
  on<T extends TEvent>(type: string, handler: (event: T) => void): () => void;
  once<T extends TEvent>(type: string, handler: (event: T) => void): () => void;
  off(type: string): void;
  emit(event: TEvent): void;
  removeAllListeners(): void;
  listenerCount(type: string): number;
  eventTypes(): string[];
}

Factory Methods

// Direct providers
Emitter.memory<T>() → MemoryEventEmitter<T>
Emitter.node<T>() → NodeEventEmitterImpl<T>
Emitter.unit<T>(config?) → EventEmitter<T>  // Unit Architecture

// Unit creation
EventEmitter.create<T>({ provider?, id?, metadata? })

Philosophy

Events are consciousness carriers - they carry intent and context between Units. The Event system enables:

  • Local event handling with type safety
  • Unit-to-unit capability sharing through teach/learn
  • Provider flexibility for different environments
  • Foundation for distributed events

Real-world Usage

// Workflow orchestration
const workflow = EventEmitter.create<WorkflowEvent>({ provider: 'node' });

workflow.on('task.completed', async (event) => {
  if (event.isLast) {
    workflow.emit({ type: 'workflow.finished', workflowId: event.workflowId });
  }
});

// Unit capability sharing
const authUnit = AuthUnit.create();
const loggerUnit = LoggerUnit.create();

// Both learn event capabilities
authUnit.learn([workflow.teach()]);
loggerUnit.learn([workflow.teach()]);

// Now they can participate in the event system
authUnit.execute('on', 'user.login', handleLogin);
loggerUnit.execute('on', 'workflow.finished', logCompletion);

Dependencies: @synet/unit - Unit Architecture support


Part of SYNET Unit Architecture - where software components are conscious, can teach capabilities, and evolve while maintaining identity.