Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ultron

Package Overview
Dependencies
Maintainers
3
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ultron

Ultron is high-intelligence robot. It gathers intel so it can start improving upon his rudimentary design

  • 1.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
3
Created

What is ultron?

Ultron is a high-intelligence, non-blocking event emitter wrapper for Node.js. It simplifies the process of adding and removing event listeners, ensuring that listeners are properly cleaned up to prevent memory leaks.

What are ultron's main functionalities?

Adding Event Listeners

This feature allows you to add event listeners to an event emitter. The code sample demonstrates how to create an Ultron instance and add an event listener to an event emitter.

const Ultron = require('ultron');
const EventEmitter = require('events');
const emitter = new EventEmitter();
const ultron = new Ultron(emitter);

ultron.on('event', () => {
  console.log('Event triggered');
});
emitter.emit('event');

Removing Event Listeners

This feature allows you to remove specific event listeners from an event emitter. The code sample demonstrates how to add and then remove an event listener using Ultron.

const Ultron = require('ultron');
const EventEmitter = require('events');
const emitter = new EventEmitter();
const ultron = new Ultron(emitter);

function onEvent() {
  console.log('Event triggered');
}

ultron.on('event', onEvent);
ultron.remove('event', onEvent);
emitter.emit('event');

Removing All Event Listeners

This feature allows you to remove all event listeners from an event emitter. The code sample demonstrates how to add multiple event listeners and then remove all of them using the `destroy` method.

const Ultron = require('ultron');
const EventEmitter = require('events');
const emitter = new EventEmitter();
const ultron = new Ultron(emitter);

ultron.on('event1', () => {
  console.log('Event 1 triggered');
});
ultron.on('event2', () => {
  console.log('Event 2 triggered');
});
ultron.destroy();
emitter.emit('event1');
emitter.emit('event2');

Other packages similar to ultron

Keywords

FAQs

Package last updated on 22 Nov 2017

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc