Socket
Socket
Sign inDemoInstall

whevent

Package Overview
Dependencies
0
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

whevent

A simple event system.


Version published
Maintainers
1
0

Weekly downloads

Readme

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.bind('SPEAK', function1, this);

// Bind the signal with another event function, but this function will always get called first!
whevent.bindPriority('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.bindOnce('SPEAK', function3, this);

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

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

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

Keywords

FAQs

Last updated on 05 Jul 2018

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc