English
Open in Telegram

Post CHALLENGE

15 October 2026
J
JavaScript
CHALLENGE class EventBus { #listeners = new Map(); on(event, cb) { if (!this.#listeners.has(event)) this.#listeners.set(event, []); this.#listeners.get(event).push(cb); return this; } emit(event, ...args) { const cbs = this.#listeners.get(event) || []; return cbs.map(cb => cb(...args)); } } const bus = new EventBus(); bus.on('data', x => x * 2).on('data', x => x + 1); const results = bus.emit('data', 5); console.log(results, bus.emit('missing', 1));
❤3
1 · 1.1K ·

Nearby in the feed

JJavaScriptPollJJavaScript💻 Deno is Joining Cloudflare (But…) Maybe David Bushell saw the writing on the wall, as the Deno team isn't joining Cloudflare to keep working on Deno, but to f
this message
JJavaScriptPollJJavaScript🤟 You Don’t Know Node.js EventLoop (30 min read) You might be wondering if the title of this article is a bit ambitious, but fear not! I’ve put in the time and
JJavaScriptJavaScript@javascript · channel · Tech
30 984subscribers1 202average post reach
Venue feed Open in Telegram

An open public feed from the search index ChatCrawler — “Google for public Telegram”; refreshed as the venue is crawled. Times are UTC.

Public content only, official Telegram API. About · FAQ · Index limits · Remove a page · Catalog · Search · How we count