2 ms·
I haven't used that once since I found out that it exists. I just don't see the point. It doesn't work in the browser and it shadows global.setTimeout which is
by hombre_fatal 2y ago
I haven't used that once since I found out that it exists.
I just don't see the point. It doesn't work in the browser and it shadows global.setTimeout which is confusing. Meanwhile the idiom works everywhere.
- joshmanders 2y agoYou can alias it if you're worried about shadowing. import { setTimeout as loiter } from "node:timers/promises"; await loiter(500);
- hombre_fatal 2y agoSure, and that competes with a universal idiom. To me it's kinda like adding a shallowClone(old) helper instead of writing const obj = { ...old }. But no point in arguing about it forever.