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

yaeti

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

yaeti

Yet Another EventTarget Implementation

  • 1.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
765K
decreased by-13.19%
Maintainers
1
Weekly downloads
 
Created

What is yaeti?

The 'yaeti' npm package is a lightweight library that provides a simple implementation of the EventTarget interface, which is a part of the DOM specification. This package is useful for creating custom event-driven architectures in JavaScript applications.

What are yaeti's main functionalities?

EventTarget Implementation

This feature allows you to create an instance of EventTarget, add event listeners, and dispatch events. It mimics the behavior of the EventTarget interface found in the DOM, making it useful for custom event handling in non-DOM environments.

const yaeti = require('yaeti');

// Create an instance of EventTarget
const eventTarget = new yaeti.EventTarget();

// Define an event listener
function eventListener(event) {
  console.log('Event received:', event.type);
}

// Add the event listener
eventTarget.addEventListener('customEvent', eventListener);

// Dispatch an event
const event = new yaeti.Event('customEvent');
eventTarget.dispatchEvent(event);

Custom Event Creation

This feature allows you to create custom events with additional properties. The 'detail' property can be used to pass extra information with the event, similar to the CustomEvent interface in the DOM.

const yaeti = require('yaeti');

// Create a custom event with additional properties
const customEvent = new yaeti.Event('customEvent', {
  detail: { key: 'value' }
});

// Access the custom properties
console.log(customEvent.detail); // Output: { key: 'value' }

Other packages similar to yaeti

FAQs

Package last updated on 10 Jan 2022

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