Skip to content

2.0.0

Pre-release
Pre-release
Compare
Choose a tag to compare
@developit developit released this 26 May 22:44
4594463

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.