export default function mitt(e){return{all:e=e||new Map,on(t,n){const i=e.get(t);i&&i.push(n)||e.set(t,[n])},off(t,n){const i=e.get(t);i&&i.splice(i.indexOf(n)>>>0,1)},emit(t,n){(e.get(t)||[]).slice().map((e=>{e(n)})),(e.get("*")||[]).slice().map((e=>{e(t,n)}))}}}