Comment

Comment by seliopou

Here's what you can do without using whenever that addresses your issue, and possibly others'. As far as I can tell what people don't like is the inlined function. You can get rid of that and be descriptive about what's going on, all without the use of whenever:

  whenever("Click Me!").is('clicked').then('change it to "clicked"')
turns into:

  var cbs = {};
  cbs.setClickedText = function() { $(this).text('Clicked!'); };

  $('a#click-me').click(cbs.setClickedText);
parent seliopou 15 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton