I just had a quick stab at this but it'll need a bit more time to get working for multiple calls of p.then. I'd been assuming that it always chained calls, but you can actually call two things at the same time with it.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
The relevant issue is this one: https://github.com/espruino/Espruino/issues/894
I just had a quick stab at this but it'll need a bit more time to get working for multiple calls of
p.then
. I'd been assuming that it always chained calls, but you can actually call two things at the same time with it.