logoalt Hacker News

blatantly04/01/20251 replyview on HN

23 byte version:

    // Lib code>>
    s={};call=(n)=>{s[n]()}
    // <<

    s.hello=()=>console.log('hello');
    call('hello');
    delete s.hello;

Replies

pavlov04/01/2025

This is missing the subscription feature?

Multiple independent listeners should be able to attach a callback that fires when “hello” is called.