Actyx / machines

5 stars 0 forks source link

Add local `destroy` in `MachineRunnerIterableIterator` #94

Closed Kelerchian closed 7 months ago

Kelerchian commented 7 months ago

MachineRunnerIterableIterator is an object that's incorporated in machine to provide next, peek, and destroy, but also returned by the noAutoDestroy method.

The noAutoDestroy variant, unlike the original machine it comes from, doesn't have a destroy method. Users have to resort to breaking/throwing from the for-await loop to destroy it.

With local destroy introduced, users can directly destroy a noAutoDestroy copy without breaking from a for-await loop