opennetwork / iterable

MIT License
1 stars 0 forks source link

Move to weak references #2

Open fabiancook opened 5 years ago

fabiancook commented 5 years ago

https://github.com/opennetwork/iterable/blob/6fceaa0b7b687dd18f1f4b3ae58a1d006f878869/src/core/transient-source.ts#L215

Right now we are forcing users to complete their iterations, but this may not always be the case, this would lead to ever growing stacks of values for something that is never going to be utilized.

This would mean that an iterator would have to maintain its own view of the data as well

To achieve this we need to split being able to directly push to an iterable, this will allow for an internal source that all iterators "listen in on", it would be a sync iterator because it is a sync process of setting a value.

This would remove the need to loop over every id and modify the array of values each time there is an iteration

It would also greatly improve and simplify the overall implementation