You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Not going to open a PR for this because I haven't tested it beyond compilation, and not sure it's something you'll want.
Switching the code to using async/await instead of manually creating promises can simplify some of the code, reduces indentation, and shaves 90 lines off the source.
See 5902723 for a commit that switches most code over to this pattern.
In particular, I think devicetoUSBDevice simplifies nicely, as does openDevice. It also makes the code from #39 more robust, as Promise.all will short-circuit if one of the promises rejects, moving on to closing the adapter while the other promises are still unresolved, which might cause an error.
Some food for thought.
The text was updated successfully, but these errors were encountered:
Aync/await in typescript created bulky code when this library was initially written, so it was avoided.
However I'm keen to switch to this method of doing things in a lot of my libraries. The problem is time and balancing potential bug introductions with new features :)
Not going to open a PR for this because I haven't tested it beyond compilation, and not sure it's something you'll want.
Switching the code to using
async
/await
instead of manually creating promises can simplify some of the code, reduces indentation, and shaves 90 lines off the source.See 5902723 for a commit that switches most code over to this pattern.
In particular, I think
devicetoUSBDevice
simplifies nicely, as doesopenDevice
. It also makes the code from #39 more robust, asPromise.all
will short-circuit if one of the promises rejects, moving on to closing the adapter while the other promises are still unresolved, which might cause an error.Some food for thought.
The text was updated successfully, but these errors were encountered: