DEV Community

Discussion on: Elegant way to check if a Promise is pending

Collapse
 
samwisela profile image
SamwiseLA

Just wanted to thank you.

This is all I needed.

Why? I am doing an animation in VR and the Avatar triggers the animation AND I do not want it retriggered until it ends. Like an elevator ride that I do not want interrupted. This worked great! If you're ever in ASVR (AltSpaceVR) come and check out what I'm talking about. Like, a Hot Air Balloon Rise...

Collapse
 
callmelann profile image
CallMeLaNN

I'm not sure if I understand correctly, but maybe you not using Promise in a way you imagine the outcome.

If you chain the promises (to put observe it in the middle of the chain) the original consumer of the final promise in the chain doesn't affected as long as you pass the resolve value around.

If you append more .then() to the original promise, you can get notified and the consumer of the promise unaffected.

It doesn't affect the performance or lag unless you add sync I/O, it is just code structure. I believe there will be an extra tiny processing of inspect above then using plain Promise#then