diff --git a/index.js b/index.js index a158efe..956b5fe 100644 --- a/index.js +++ b/index.js @@ -1,12 +1,18 @@ export let createNanoEvents = () => ({ emit(event, ...args) { - for (let i = 0, callbacks = this.events[event] || [], length = callbacks.length; i < length; i++) { + for ( + let i = 0, + callbacks = this.events[event] || [], + length = callbacks.length; + i < length; + i++ + ) { callbacks[i](...args) } }, events: {}, on(event, cb) { - (this.events[event]||=[]).push(cb); + ;(this.events[event] ||= []).push(cb) return () => { this.events[event] = this.events[event]?.filter(i => cb !== i) }