Skip to content

Commit

Permalink
fix: allow listeners to be edited inside called callbacks (#202)
Browse files Browse the repository at this point in the history
  • Loading branch information
theomonnom committed May 19, 2024
1 parent 7383150 commit 91a7a35
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion livekit-rtc/livekit/rtc/_event_emitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ def __init__(self) -> None:

def emit(self, event: T, *args, **kwargs) -> None:
if event in self._events:
for callback in self._events[event]:
callables = self._events[event].copy()
for callback in callables:
callback(*args, **kwargs)

def once(self, event: T, callback: Optional[Callable] = None) -> Callable:
Expand Down

0 comments on commit 91a7a35

Please sign in to comment.