Slacker News Slacker News logo featuring a lazy sloth with a folded newspaper hat
  • top
  • new
  • show
  • ask
  • jobs
Library
← Back to context

Comment by blatantly

3 months ago

23 byte version:

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

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

1 comment

blatantly

Reply

pavlov  3 months ago

This is missing the subscription feature?

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

Slacker News

Product

  • API Reference
  • Hacker News RSS
  • Source on GitHub

Community

  • Support Ukraine
  • Equal Justice Initiative
  • GiveWell Charities