emitter

Supranim's Event Emitter, allowing you to subscribe & listen for various events within your application

Active Pure Nim score 66/100 · last commit 2026-07-17 · 7 stars · tests present · no docs generated

Summary

Latest Version Unknown
License MIT
CI Status Failing
Stars 7
Forks 0
Open Issues 0
Last Commit 2026-07-17
Downloads 0
Last Indexed 2026-07-21 05:25

Installation

nimble install emitter
choosenim install emitter
git clone https://github.com/supranim/emitter

OS Compatibility

Platform Linux macOS Windows FreeBSD OpenBSD NetBSD Android iOS WASM Embedded
emitter - - - - - - -

Source

Repository https://github.com/supranim/emitter
Homepage https://github.com/supranim/emitter
Registry Source github

README

Supranim Events Emitter
Supranim's Event Emitter - Subscribe & listen for various events within your application

✨ Key features

  • [x] Framework Agnostic
  • [x] Available in ⚡️ Supranim Framework
  • [ ] Persistent Memory w/ Supranim Storage driver
  • [x] Dependency-free
  • [x] Open Source | MIT License

Install

nimble install emitter

Examples

Listeners can receive data as varargs[Arg] objects, containing a public value field of Any object. Check std/typeinfo

Framework agnostic usage

# somewhere in your main application
Event.listen("account.email.changed") do(args: varargs[Arg]):
    echo "Email address has been changed."
    # do the do, send confirmation mails, etc...

# somewhere in your proc-based ``POST`` or ``UPDATE`` controller
let newEmailAddress = "new.address@example.com"
Event.emit("account.email.changed", newArg(newEmailAddress))

Emitter from Supranim

For apps based on Supranim Application Template. Note that all listeners should be stored inside events/listeners directory.

In Supranim is highly recommended to create a .nim file for each branch of your application logic. For example, account.nim should hold all listeners related to accounts (email updates, password reset requests and so on).

For loading listeners into your application is recommended to use include, instead of import. Listener files can be included in the main state of your application (this is usually the main .nim file of your project.)

TODO. Create new listeners using Sup, the Command Line Interface of your Supranim application

# src/events/listeners/account.nim

Event.listen("account.email.update") do(args: varargs[Arg]):
    echo "The email address has been changed."

Event.listen("account.password.reset.request") do(args: varargs[Arg]):
    echo "Request for password reset."

Event.listen("account.password.update") do(args: varargs[Arg]):
    echo "Password has been changed."

❤ Contributions & Support

🎩 License

MIT license. Made by Humans from OpenPeeps.
Copyright © 2025 OpenPeeps & Contributors — All rights reserved.