Skip to content

Commit

Permalink
Prettierify code
Browse files Browse the repository at this point in the history
  • Loading branch information
ai committed Nov 23, 2023
1 parent 6e0f391 commit debe0db
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -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)
}
Expand Down

0 comments on commit debe0db

Please sign in to comment.