Skip to content
This repository was archived by the owner on Feb 14, 2024. It is now read-only.

Latest commit

 

History

History
28 lines (23 loc) · 754 Bytes

README.md

File metadata and controls

28 lines (23 loc) · 754 Bytes

Trigger-Nim

Note: This is not going to be maintained purely because I think it's limited in how it can be used, and I much prefer Pulse when compared to this. Use that, or fork this repo instead please!

Trigger is a simple and half-assed attempt at an event system written in Nim, made for use in Nimberite! An example of how to use it:

type
  # Unneeded but good for clarity
  ListenerProc = proc(val: int)
  EventData = (int,)

let eventSystem = eventSystem[ListenerProc, EventData]()

discard eventSystem.addListener(
  proc(val: int) =
    echo "A: ", val
)

discard eventSystem.addListener(
  proc(val: int) =
    echo "B: ", val
)

eventSystem.fire (1,)
eventSystem.fire (2,)