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
Weekly downloads
0
Maintainers
1
Created
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');

// Event function
var onSpeak = function(line){
   console.log(line);
};

// Event function 2
var onSpeakFirst = function(line){
   console.log('Speak first: ' + line);
};

// Bind the event function with the signal
whevent.bind('SPEAK', onSpeak, this);

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

// Call the event: whevent.call(signal, data);
// Result:
// > Speak first: Hello
// > Hello
whevent.call('SPEAK', 'Hello');

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

License

MIT

Keywords

FAQs

Last updated on 03 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