Skip to main content

Package name: Jevents

  • Author: Jaime Loeuf
  • License: MIT
  • Package Desciption:
    • This package contains classes/functions to implement data_observer patterns and use of EventEmitters like those provided by NodeJS runtime and other languages.
    • This package does not have any external dependencies.
    • Currently this package contains the
      1. 'Watch' class
      2. 'wait_for_daemons' function
    • Currently lacking more documentation. For now please view test scripts for the different modules to see how to use this Package.
Below is a watered down example on how to use the Watch class. The full version is available inside the test_watch.py script in the 'test' directory.
from Jevents import Watch
from Jevents import wait_for_daemons

# Create a new data variable and store in the watchData object
sensorData = Watch(12)
# The data stored in the object can be accessed via the value property
print(sensorData.value)
# Alternatively it can also be accessed by calling itself with the help of the __repr__
print(sensorData)


# Define a callback function. All callback functions can expect a input parameter of the data watched.
def chicken(data):
	print('Chicken nuggets ', data)


# Using __iadd__ magic method to set/append an on_change callback function
sensorData.on_change += chicken

# Add a time delay to simulate real life async operations
sleep(1.4)
# Update the data in the object, this will cause all the callbacks to be called.
sensorData(1)
# Print out the updated value stored in the object.
print(sensorData)

# Add a time delay to simulate real life async operations
sleep(1.4)
# Update the data in the object. Notice nothing happens even when a new value is being set.
sensorData(5)
# Print out the updated value stored in the object.
print(sensorData)

# Call the wait function to stop main thread from ending before the daemonic threads finnish
wait_for_daemons()

Release files for Jevents 1.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for Jevents 1.1.3
File Size Uploaded
Jevents-1.1.3.tar.gz 5.2 kB Details

Release files / Jevents-1.1.3.tar.gz

Download URL Jevents-1.1.3.tar.gz
Size 5.2 kB
Tags Source
SHA-256 checksum
How to use checksums
87106d55934a4bf9187d8b36636dfccd3b0eee4df8fcd43b14455b311ee8414c
BLAKE2b-256 checksum
How to use checksums
115a62106b35a6c81bdc3f0ffc43272dd53c5bb83eb75724e09720cd001e6819
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.1

Release history Release notifications | RSS feed

This release

1.1.3 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page