npm mitt 2.0.0

latest releases: 3.0.1, 3.0.0, 2.1.0...
3 years ago

Possible Breaking Change: mitt() previously accepted an optional Object "event map" argument. In 2.0.0, events are stored in an actual JavaScript Map rather than as properties on a plain object:

import mitt from 'mitt';
- const map = {};
+ const map = new Map();

const events = mitt(map);
const foo = () => {};
events.on('foo', foo);

- map.foo // [foo];
+ map.get('foo') // [foo];

Now the good news: if you weren't using this argument, mitt@2 isn't a breaking change for you.

Also, Mitt is now written in TypeScript! Huge thanks to @jackfranklin for doing all the work including setting up a much nicer build toolchain.

Don't miss a new mitt release

NewReleases is sending notifications on new releases.