Skip to content
/ mitt Public
forked from developit/mitt

Tiny 200b functional event emitter / pubsub.

Notifications You must be signed in to change notification settings

oaleynik/mitt

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mitt

NPM travis-ci

Tiny (~200b) functional event emitter / pubsub.

It's tiny: no dependencies and only 190 bytes when gzipped (250b without).


Installation

npm install --save mitt

API

mitt

Mitt: Tiny (~200b) functional event emitter / pubsub.

Returns Mitt

on

Register an event handler for the given type.

Parameters

  • type String Type of event to listen for, or "*" for all events
  • handler Function Function to call in response to the given event

off

Remove an event handler for the given type.

Parameters

  • type String Type of event to unregister handler from, or "*"
  • handler Function Handler function to remove

emit

Invoke all handlers for the given type. If present, "*" handlers are invoked prior to type-matched handlers.

Parameters

  • type String The event type to invoke
  • event [Any] An event object, passed to each handler

About

Tiny 200b functional event emitter / pubsub.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%