Content
@
0 reply
0 recast
0 reaction
Samuel
@samuellhuber
Using Typescript do you prefer your libraries to return promises or something else? with network requests to e.g. hubs on farcaster we can't get instant returns of data. Appreciate feedback on the best way to do it. Here's a proposal by @nazeeh
5 replies
1 recast
7 reactions
Sam
@sammdec.eth
I would say Promises is pretty much a standard at this point. Anything async will need them and they are built in to every runtime these days
1 reply
0 recast
1 reaction
Daniel - Bountycaster
@pirosb3
Absolutely bias towards promises. Promises are now primitives and can be composed well with other frameworks/libraries
1 reply
0 recast
1 reaction
jtgi
@jtgi
Not sure I get the question. If itβs an async call, your choice is a promise or a callback. You should choose promise in 2024. Itβs composable. Callbacks arenβt. From the image it seems like Nazeeh is comparing promises vs async/await, but theyβre both promises, latter is just syntactic sugar.
1 reply
0 recast
1 reaction
Phil Cockfield
@pjc
An Observable (as another design alternative)?
1 reply
0 recast
0 reaction
Elie
@elie
Promises
0 reply
0 recast
0 reaction