AwaitKit icon indicating copy to clipboard operation
AwaitKit copied to clipboard

Can make Additions for `when(action1, action2...)` usages ?

Open yangzhixiao opened this issue 6 years ago • 6 comments

for PromiseKit usage: when(xxx, xxx).then { r1, r2 in .... }

adding for AwaitKit? just like: let (r1, r2) = try await(xxx, xxx)

yangzhixiao avatar Mar 16 '18 02:03 yangzhixiao

+1 for that

igor9silva avatar Mar 21 '18 16:03 igor9silva

This would be so useful.

J7mbo avatar Mar 28 '18 19:03 J7mbo

@yannickl Hey dude, I've been promoting this libraries' awesomeness every minute I get a chance to, and wrote a blog post on it. Reckon this task's a possibility? :-)

J7mbo avatar Sep 02 '18 10:09 J7mbo

I don't know if I would support this syntax because If we start it requires to implements all the possible signature.

May be the Guarantee would be better #30?

try await(when(t1, t2, t3))

I don't have time for the moment, so if someone want to implement this, he/she's welcome.

@J7mbo thank you for your support, that's nice!

yannickl avatar Sep 05 '18 18:09 yannickl

Any updates on implementing Guarantee?

hanyuone avatar Jan 17 '19 14:01 hanyuone

@Qwerp-Derp I don't have time to implement something similar. But there is this alternative that is working:

let p1 = myPromise1()
let p2 = myPromise2()
let p3 = myPromise3()

try! await(when(fulfilled: [p1, p2, p3]))

The only drawback is that the when method returns a Promise<Void> so you can't retrieve the values.

yannickl avatar Jan 17 '19 15:01 yannickl