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

can-event-queue

Package Overview
Dependencies
Maintainers
4
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

can-event-queue

A event mixin that uses queues to dispatch handlers

  • 0.11.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.8K
decreased by-28.48%
Maintainers
4
Weekly downloads
 
Created
Source

can-event-queue

Build Status

can-event-queue mixes in event binding and dispatching methods that use can-queues. This adds legacy binding methods addEventListener and removeEventListener. This package should not be used for new packages.

Use

var eventQueue = require("can-event-queue");

var obj = eventQueue(obj);

// obj now has `.on`, `.dispatch`, `.addEventListener` methods
// as well as `can.onKeyValue` and `can.offKeyValue` symbols.


obj.on("event", function(){
    console.log("event fired!")
});

obj.dispatch("event");

Critically, event handlers can be registered to run in different queues.

var obj = eventQueue(obj);

obj.on("event", function mutateHandler(){
    console.log("mutate")
}, "mutate");


obj.on("event", function(){
    console.log("notify")
}, "notify");

obj.dispatch("event"); // logs "notify" then "mutate" because notify comes first

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