Thanks to visit codestin.com
Credit goes to github.com

Skip to content

inject3r/EcmaTimer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EcmaTimer

PyPI version Supported Python versions PyPI downloads Code style: Black

Installation

From PyPI

python3 -m pip install --upgrade EcmaTimer

From source

git clone https://github.com/inject3r/EcmaTimer.git
cd EcmaTimer
python3 -m pip install .

Example

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())

Features

  • Asynchronous timers using asyncio.
  • Repeating and one-shot timers.
  • Exception handling for timer errors.
  • Easy integration into async Python applications.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Issues

If you find a bug or want to request a feature, please open an issue on GitHub. (ـ

About

An advanced timer library for managing scheduled tasks in Python.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages