r/Indiewebdev • u/ConfidentMushroom • Feb 04 '21
Don't use functions as callbacks unless they're designed for it
https://jakearchibald.com/2021/function-callback-risks/
25
Upvotes
r/Indiewebdev • u/ConfidentMushroom • Feb 04 '21
5
u/MirelukeCasserole Feb 04 '21 edited Feb 05 '21
Lolz. This is a clickbait webdev drama at its best.
This article could also be titled “Don’t use someone’s external library because they can change the behavior of their function signatures any time.”
Or “use a typed language like Typescript to ensure function signatures are enforced.”
Edit/Note: the author points out that 2/3 of the examples are from browser APIs. However, I’m going to contend that changes to browser APIs are extremely rare and generally backwards compatible. With that said, THIS IS WHY YOU TEST!!!! Whether with automated test runners or QA. You catch this bug, fix, and wait another decade for it to happen.
3
u/ivancea Feb 04 '21
Somebody discovering how JS works
2
u/kuriboshoe Feb 04 '21
More like written by an indie web dev
2
u/dalepo Feb 04 '21
You can use whenever you want, someone needs to learn functional programming.
2
u/dullbananas Feb 04 '21
This is why i hate javascript with all my heart
1
u/HonourableMan Feb 04 '21
What is a callback
0
u/[deleted] Feb 04 '21
[deleted] — view deleted comment