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

can-event-queue

Package Overview
Dependencies
Maintainers
9
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

  • 1.1.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.8K
decreased by-28.48%
Maintainers
9
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

import eventQueue from "can-event-queue";

const 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.

const 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 06 Dec 2018

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