CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-wolfy87-eventemitter

Event based JavaScript for the browser with comprehensive event management API

91

1.26x
Overview
Eval results
Files

task.mdevals/scenario-10/

Universal Event Notifier

Build a notification system that works across different JavaScript environments (Node.js/CommonJS and browser globals).

Capabilities

Module Loading Support

  • The notifier can be loaded using require() in a Node.js/CommonJS environment @test
  • The notifier can be loaded in a browser environment and exposes itself as a global variable @test

Event Management

  • The notifier can register listeners and emit notification events with message payloads @test
  • Multiple listeners can subscribe to and receive the same notification event @test

Implementation

@generates

API

/**
 * Universal notification system that works in multiple JavaScript environments.
 *
 * Supports:
 * - CommonJS/Node.js: const notifier = require('./notifier');
 * - Browser global: <script src="notifier.js"></script> // creates global.Notifier
 *
 * @class Notifier
 * @extends EventEmitter
 */

/**
 * Emits a notification event to all registered listeners.
 *
 * @param {string} message - The notification message
 * @returns {Notifier} The notifier instance for chaining
 */
function notify(message) {}

/**
 * Registers a listener for notification events.
 *
 * @param {Function} listener - The callback function to invoke when notifications occur
 * @returns {Notifier} The notifier instance for chaining
 */
function onNotification(listener) {}

Dependencies { .dependencies }

wolfy87-eventemitter { .dependency }

Provides event emitter functionality with module system compatibility.

@satisfied-by

Install with Tessl CLI

npx tessl i tessl/npm-wolfy87-eventemitter

tile.json