Merge pull request #95 from knowhere01/master

Events not working as expected
This commit is contained in:
rlaphoenix 2024-04-05 12:25:33 +01:00 committed by GitHub
commit b7ea94de29
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 1 deletions

View File

@ -341,6 +341,7 @@ Please refrain from spam or asking for questions that infringe upon a Service's
<a href="https://github.com/varyg1001"><img src="https://images.weserv.nl/?url=avatars.githubusercontent.com/u/88599103?v=4&h=25&w=25&fit=cover&mask=circle&maxage=7d" alt="varyg1001"/></a>
<a href="https://github.com/Hollander-1908"><img src="https://images.weserv.nl/?url=avatars.githubusercontent.com/u/93162595?v=4&h=25&w=25&fit=cover&mask=circle&maxage=7d" alt="Hollander-1908"/></a>
<a href="https://github.com/Shivelight"><img src="https://images.weserv.nl/?url=avatars.githubusercontent.com/u/20620780?v=4&h=25&w=25&fit=cover&mask=circle&maxage=7d" alt="Shivelight"/></a>
<a href="https://github.com/knowhere01"><img src="https://images.weserv.nl/?url=avatars.githubusercontent.com/u/113712042?v=4&h=25&w=25&fit=cover&mask=circle&maxage=7d" alt="knowhere01"/></a>
## Licensing

View File

@ -1,5 +1,6 @@
from __future__ import annotations
from copy import deepcopy
from enum import Enum
from typing import Any, Callable
@ -25,10 +26,11 @@ class Events:
def reset(self):
"""Reset Event Observer clearing all Subscriptions."""
self.__subscriptions = self.__ephemeral = {
self.__subscriptions = {
k: []
for k in Events.Types.__members__.values()
}
self.__ephemeral = deepcopy(self.__subscriptions)
def subscribe(self, event_type: Events.Types, callback: Callable, ephemeral: bool = False) -> None:
"""