forked from platypush/platypush
Added support for custom user events
This commit is contained in:
parent
c5dc9333f0
commit
cc36325ca6
3 changed files with 24 additions and 0 deletions
|
@ -16,6 +16,7 @@ Events
|
|||
platypush/events/chat.telegram.rst
|
||||
platypush/events/clipboard.rst
|
||||
platypush/events/covid19.rst
|
||||
platypush/events/custom.rst
|
||||
platypush/events/distance.rst
|
||||
platypush/events/foursquare.rst
|
||||
platypush/events/geo.rst
|
||||
|
|
5
docs/source/platypush/events/custom.rst
Normal file
5
docs/source/platypush/events/custom.rst
Normal file
|
@ -0,0 +1,5 @@
|
|||
``platypush.message.event.custom``
|
||||
==================================
|
||||
|
||||
.. automodule:: platypush.message.event.custom
|
||||
:members:
|
18
platypush/message/event/custom.py
Normal file
18
platypush/message/event/custom.py
Normal file
|
@ -0,0 +1,18 @@
|
|||
from platypush import Event
|
||||
|
||||
|
||||
class CustomEvent(Event):
|
||||
"""
|
||||
This type can be used to fire custom events upon which the user can implement custom hooks.
|
||||
"""
|
||||
def __init__(self, subtype: str, *args, **kwargs):
|
||||
"""
|
||||
:param subtype: This is the only mandatory attribute for this event type. It should be a string that
|
||||
unambiguously identifies a certain type of event (like ``DISHWASHER_STARTED`` or ``SMOKE_DETECTED``).
|
||||
:param args: Extra list arguments for the event.
|
||||
:param kwargs: Extra key-value arguments for the event.
|
||||
"""
|
||||
super().__init__(*args, subtype=subtype, **kwargs)
|
||||
|
||||
|
||||
# vim:sw=4:ts=4:et:
|
Loading…
Reference in a new issue