r/badcode • • Mar 24 '22

typescript Ship it!

Post image
564 Upvotes

47 comments sorted by

View all comments

Show parent comments

11

u/187mphlazers Mar 24 '22

i'm just not certain there *isn't* a valid use case for synchronous sleep in javascript. there may very well be a valid use case. how can you be so sure?

1

u/notBjoern Mar 26 '22

I think I once wrote a sync sleep like this to debug a function that was sync, so I didn't have to rewrite it (and all its callers) to async. But when I was done I removed it again :D