▲ | ftigis 2 days ago | |
This isn't the same though. With EventTarget, if one of the callback throws, the later callbacks would still get called. With yours the later callbacks don't get called. | ||
▲ | chrismorgan 2 days ago | parent [-] | |
True, I forgot about that. Habit of working in Rust, perhaps, and generally avoiding exceptions when working in JavaScript. Well then, a few alternatives to replace f=>f(d), each with slightly different semantics: • async f=>f(d) (+6, 103 bytes). • f=>{try{f(d)}catch{}} (+14, 111 bytes). • f=>setTimeout(()=>f(d)) (+16 bytes, 113 bytes). • f=>queueMicrotask(()=>f(d)) (+20 bytes, 117 bytes). |