Alternative names for `withResolvers()`
I am sure I'm not the only one who thinks `Promise.withResolvers()` does not sound right. To see the name, I would expect it to be something that you pass one or more `resolve`s into and it returns a `Promise`.
I think `getResolvers()` makes more sense, but it's still not descriptive of what it does. It returns the `promise` as well.
I don't have a good name, but "extract", "expose", "unwrap", & "destructure" seem like more descriptive words that imply what it would do. What exactly would you call `{ promise, resolve, reject }`? What would you call the object that it returns?
关闭于 2023-07-06 65 条评论