refactor: wrap event queue in a constructor
refactor: rename add/read to enqueue/dequeue
extract emit functions