Registry / communication / microee

microee

JSON →
library0.0.6jsnpmunverified

MicroEE is an extremely lightweight, EventEmitter-like library designed for both client and server-side event routing. At approximately 50 lines of code and ~1200 characters, it was created to be significantly smaller than other event emitter implementations of its time. The package's current stable version is 0.0.6, which was published nearly a decade ago, indicating it is no longer actively maintained. Its primary differentiators were its minimal footprint and a simple API largely based on Node.js's native EventEmitter, with additions like `emitter.when()` for conditional listener removal and `microee.mixin()` for easily extending objects to become event emitters. It lacks modern features like `async` event handling or native ES module support.

npm install microee
INSTALL
IMPORT
SIG · MICROEE
M
microee
communicationjavascriptv0.0.6
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

MicroEE
const MicroEE = require('microee');
import { MicroEE } from 'microee';
This package is CommonJS-only and does not support ES modules natively. It also exports a global `microee` in browser environments.
mixin
const MicroEE = require('microee'); MicroEE.mixin(MyClass);
import { mixin } from 'microee';
The `mixin` utility is a static method on the MicroEE constructor, used to extend a class prototype. It is not a named export.
emitter.on
const obj = new MyClass(); obj.on('event', listener);
Methods like `on`, `emit`, `once` are prototypal methods after applying `MicroEE.mixin` or instantiating MicroEE directly.

Demonstrates how to use `microee.mixin` to make a class an event emitter, along with basic `on`, `emit`, `once`, and `when` methods.

const MicroEE = require('microee'); function MyClass() { // Constructor logic } MicroEE.mixin(MyClass); MyClass.prototype.foo = function() { console.log('foo method called'); this.emit('fooCalled', 'data from foo'); }; const obj = new MyClass(); // Add a listener for 'event' obj.on('event', function(arg1, arg2) { console.log(`'event' fired with args: ${arg1}, ${arg2}`); }); // Add a one-time listener for 'onceEvent' obj.once('onceEvent', function() { console.log("'onceEvent' fired - this will only happen once."); }); // Add a listener that removes itself conditionally let counter = 0; obj.when('conditionalEvent', function() { counter++; console.log(`'conditionalEvent' fired, counter: ${counter}`); return counter >= 2; // Remove listener after 2 fires }); // Emit events obj.emit('event', 'hello', 'world'); // Triggers 'event' listener obj.emit('onceEvent'); // Triggers 'onceEvent' listener once obj.emit('onceEvent'); // Does nothing now obj.emit('conditionalEvent'); // Triggers 'conditionalEvent' (counter 1) obj.emit('conditionalEvent'); // Triggers 'conditionalEvent' (counter 2) and removes itself obj.emit('conditionalEvent'); // Does nothing now obj.foo(); // Calls foo, which emits 'fooCalled' obj.on('fooCalled', (data) => console.log(`'fooCalled' received: ${data}`)); obj.foo();
Debug
Known issues
breakingThis package explicitly does not support RegExp matching for event names, unlike some other EventEmitter implementations. Event names must be exact strings.
fix
Use exact string event names. If dynamic event matching is required, implement custom logic or use a different library.
affects: >=0.0.1
deprecatedThe `microee` package is abandoned. The last release (v0.0.6) was published 9 years ago, and there is no ongoing maintenance or development. It is not recommended for new projects.
fix
Migrate to a actively maintained event emitter library such as Node.js's built-in `EventEmitter` (if in Node.js) or a modern standalone package like `eventemitter3` or `mitt`.
affects: >=0.0.1
gotchaThe package is CommonJS-only and relies on `require()` for Node.js or a global `microee` object in browsers. It does not provide native ES module (`import`) support.
fix
If using in a modern ES module environment, you might need a CommonJS compatibility layer or bundler configuration to consume it, or simply use `require()` if your environment supports it. Prefer a modern alternative for ESM projects.
affects: >=0.0.1
Errors
Common errors & fixes
ReferenceError: MicroEE is not defined
Attempting to use `MicroEE` without correctly importing/requiring it in a CommonJS or browser environment, or trying to use `import` syntax.
fix
Ensure you are using `const MicroEE = require('microee');` in Node.js or confirming the `microee` global is available in your browser context. If using ES modules, you must configure your bundler to handle CommonJS modules or use a different library.
TypeError: obj.on is not a function
An object intended to be an event emitter has not had the `MicroEE.mixin` applied to its prototype or is not an instance of a class that has applied the mixin.
fix
Before calling `on` or `emit` methods, ensure your class or object's prototype has been extended with `MicroEE.mixin(MyClass)` for class-based usage, or that you are using an instance created by `new MicroEE()` directly.
Upgrade
Version history
0.0.6latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
13 hits · last 30 days
node
12
OpenAI (training)
1
Resources
microee — npm install microee · libregistry