News for hackers. Stuff that matters.
Re:Breaking Up with Long Tasks or: how I learned to group lo... by pavlov on Saturday January 04, 2025 @10:15AM (#42595171)
So, the same thing as callbacks in Node.
Re:Breaking Up with Long Tasks or: how I learned to group lo... by fenomas on Saturday January 04, 2025 @01:04PM (#42596473)
When people talk about a callback in this kind of context they usually mean one function passed as an argument to another, in order to be invoked with the latter function's return value. Not event handlers like onclick, etc.
Re:Breaking Up with Long Tasks or: how I learned to group lo... by layer8 on Saturday January 04, 2025 @01:46PM (#42596739)
I’m not familiar with Node, but static event handlers aren’t usually referred to as callbacks in that context. “Callback” implies that something is being called, for it to call back to the client code. That’s not what’s happening with the onxxx event handlers. There is no “back” there. The event loop simply calls “forward” into the JavaScript code.
Re:Breaking Up with Long Tasks or: how I learned to group lo... by pavlov on Saturday January 04, 2025 @03:06PM (#42597307)
I don’t know what you mean by “forward” because there is no difference between these two:

  img.onload = function() {…}
  img.src = “some url”

  img.load(“some url”, function() {…})
The early JavaScript APIs use the first style, but the result is the same.