developit/mitt
### [`v2.1.0`](https://togithub.com/developit/mitt/releases/2.1.0)
[Compare Source](https://togithub.com/developit/mitt/compare/2.0.1...2.1.0)
##### Mitt 2 is out of preview!
- It's written in TypeScript and ships type definitions ([#107](https://togithub.com/developit/mitt/issues/107), thanks again [@jackfranklin](https://togithub.com/jackfranklin)!)
- Event handlers are now stored in a Map instead of an Object.
> **Upgrading:** If you aren't passing an object to `mitt({})`, version 2 is backwards-compatible.
> If you were, turn your object into a map:
>
> ```diff
> -const handlers = {
> - foo: [() => alert(1)]
> -};
> +const handlers = new Map();
> +handlers.set('foo', [() => alert(1)]);
>
> const events = mitt(handlers);
> ```
- The event handler Map is now exposed as `.all`: ([#105](https://togithub.com/developit/mitt/issues/105), thanks [@jaylinski](https://togithub.com/jaylinski)!)
> ```js
> const events = mitt();
> events.on('foo', () => alert(1));
> events.on('bar', () => alert(2));
>
> // access handlers directly if needed:
> events.all.get('foo') // [() => alert(1)]
>
> // remove all event handlers:
> events.all.clear();
> ```
### [`v2.0.1`](https://togithub.com/developit/mitt/releases/2.0.1)
[Compare Source](https://togithub.com/developit/mitt/compare/2.0.0...2.0.1)
This patch update for the [2.0 prerelease](https://togithub.com/developit/mitt/releases/tag/2.0.0) fixes missing type exports ([#101](https://togithub.com/developit/mitt/issues/101)).
It also reduces size and improves performance ([#100](https://togithub.com/developit/mitt/issues/100)).
### [`v2.0.0`](https://togithub.com/developit/mitt/releases/2.0.0)
[Compare Source](https://togithub.com/developit/mitt/compare/1.2.0...2.0.0)
**Possible Breaking Change:** `mitt()` previously accepted an optional Object "event map" argument. In 2.0.0, events are stored in an actual [JavaScript Map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) rather than as properties on a plain object:
```diff
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](https://togithub.com/jackfranklin) for doing all the work including setting up a much nicer build toolchain.
Renovate configuration
:date: Schedule: At any time (no schedule defined).
:vertical_traffic_light: Automerge: Disabled by config. Please merge this manually once you are satisfied.
:recycle: Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
:no_bell: Ignore: Close this PR and you won't be reminded about this update again.
[ ] If you want to rebase/retry this PR, check this box
This PR contains the following updates:
^1.2.0
->^2.0.0
Release Notes
developit/mitt
### [`v2.1.0`](https://togithub.com/developit/mitt/releases/2.1.0) [Compare Source](https://togithub.com/developit/mitt/compare/2.0.1...2.1.0) ##### Mitt 2 is out of preview! - It's written in TypeScript and ships type definitions ([#107](https://togithub.com/developit/mitt/issues/107), thanks again [@jackfranklin](https://togithub.com/jackfranklin)!) - Event handlers are now stored in a Map instead of an Object. > **Upgrading:** If you aren't passing an object to `mitt({})`, version 2 is backwards-compatible. > If you were, turn your object into a map: > > ```diff > -const handlers = { > - foo: [() => alert(1)] > -}; > +const handlers = new Map(); > +handlers.set('foo', [() => alert(1)]); > > const events = mitt(handlers); > ``` - The event handler Map is now exposed as `.all`: ([#105](https://togithub.com/developit/mitt/issues/105), thanks [@jaylinski](https://togithub.com/jaylinski)!) > ```js > const events = mitt(); > events.on('foo', () => alert(1)); > events.on('bar', () => alert(2)); > > // access handlers directly if needed: > events.all.get('foo') // [() => alert(1)] > > // remove all event handlers: > events.all.clear(); > ``` ### [`v2.0.1`](https://togithub.com/developit/mitt/releases/2.0.1) [Compare Source](https://togithub.com/developit/mitt/compare/2.0.0...2.0.1) This patch update for the [2.0 prerelease](https://togithub.com/developit/mitt/releases/tag/2.0.0) fixes missing type exports ([#101](https://togithub.com/developit/mitt/issues/101)). It also reduces size and improves performance ([#100](https://togithub.com/developit/mitt/issues/100)). ### [`v2.0.0`](https://togithub.com/developit/mitt/releases/2.0.0) [Compare Source](https://togithub.com/developit/mitt/compare/1.2.0...2.0.0) **Possible Breaking Change:** `mitt()` previously accepted an optional Object "event map" argument. In 2.0.0, events are stored in an actual [JavaScript Map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) rather than as properties on a plain object: ```diff 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](https://togithub.com/jackfranklin) for doing all the work including setting up a much nicer build toolchain.Renovate configuration
:date: Schedule: At any time (no schedule defined).
:vertical_traffic_light: Automerge: Disabled by config. Please merge this manually once you are satisfied.
:recycle: Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
:no_bell: Ignore: Close this PR and you won't be reminded about this update again.
This PR has been generated by WhiteSource Renovate. View repository job log here.