python3 -m pip install --upgrade EcmaTimergit clone https://github.com/inject3r/EcmaTimer.git
cd EcmaTimer
python3 -m pip install .import asyncio
from EcmaTimer import SetTimer, KillTimer, HandleTimerError, TimerError
async def example_timer_function():
print("Timer triggered!")
async def main():
try:
# Set a simple timer that runs every 2 seconds
timer_id = await SetTimer(example_timer_function, 2000, repeating=True)
# Simulate waiting for some time before killing the timer
await asyncio.sleep(10)
# Kill the timer after 10 seconds
await KillTimer(timer_id)
print("Timer killed after 10 seconds.")
except TimerError as e:
await HandleTimerError(e.timer_id, e.message)
if __name__ == "__main__":
asyncio.run(main())- Asynchronous timers using
asyncio. - Repeating and one-shot timers.
- Exception handling for timer errors.
- Easy integration into async Python applications.
This project is licensed under the MIT License - see the LICENSE file for details.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
If you find a bug or want to request a feature, please open an issue on GitHub. (ـ