Skip to content
Myr

Merge branch 'expose-all' of https://github.com/jaylinski/mitt

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Jason Miller · committed by Jason Miller · parents 5116df4, 76a353c · Browse files · 3 files+27 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+27 added−4 removed

  • tests:+8 added−0 removed
  • other:+19 added−4 removed

3 files+27 added−4 removed

modified:src/index.ts+11 added-4 removed
modified:test/index_test.ts+8 added
28 unmodified lines
29 events = new Map();30 inst = mitt(events);31 });3233 describe('properties', () => {34 it('should expose the event handler map', () => {35 expect(inst)36 .to.have.property('all')37 .that.is.a('map');38 });39 });4041 describe('on()', () => {42 it('should be a function', () => {43 expect(inst)44 .to.have.property('on')
146 unmodified lines
modified:README.md+8 added
67 unmodified lines
6869// fire an event70emitter.emit('foo', { a: 'b' })7172// clearing all events73emitter.all.clear()7475// working with handler references:76function onFoo() {}77emitter.on('foo', onFoo) // listen78emitter.off('foo', onFoo) // unlisten
22 unmodified lines
101102#### Table of Contents103104- [mitt](#mitt)105- [all](#all)106- [on](#on)107 - [Parameters](#parameters)108- [off](#off)109 - [Parameters](#parameters-1)
5 unmodified lines
115Mitt: Tiny (~200b) functional event emitter / pubsub.116117Returns **Mitt** 118119### all120121A Map of event names to registered handler functions.122123### on124125Register an event handler for the given type.126
53 unmodified lines