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

whevent

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

whevent

A lite event system

  • 2.1.1
  • unpublished
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

whevent

A lite and convenient event system

Just a simple singleton event system used by myself :)

Usage

var whevent = require('whevent');

// Bind the signal with the event function: whevent.bind(signal, func, context);
whevent.on('SPEAK', function1, this);

// Bind the signal with another event function, but this function will always get called first!
whevent.onPriority('SPEAK', function2, this);

// Bind the signal with a 3rd event function
// But once the function3 get called, the binding of this function with this signal will be destroyed
whevent.onOnce('SPEAK', function3, this);

// Call the event: whevent.call(signal, data);
// Calls order: function2, function1, function3
whevent.emit('SPEAK', 'Hello!');

// Unbind the binded function with the signal
whevent.off('SPEAK', function1);

// Unbind all the binded functions associated with the listener
whevent.offBy(listener);

// Destory the signal, all bindings will be destroyed
whevent.destroy('SPEAK');

Keywords

FAQs

Package last updated on 18 Nov 2019

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