Event Bus Implementation — Publisher-Subscriber System (Part 3: Async & Priority Queue)
Build the most advanced layer of the Publisher-Subscriber system. Extend Part 2 to support: (1) asynchronous listeners — publish() should await all async subscribers and return a Promise that resolves when all listeners complete; (2) priority-based execution — subscribers can register with a numeric priority, and higher-priority listeners fire before lower-priority ones within the same event; (3) error isolation — if one listener throws or rejects, others should still execute and the errors should be collected and returned. This mirrors production-grade event systems like Node.js EventEmitter internals.