Open pietercolpaert opened 4 years ago
Cool work! In stations.all you implement a readable, and all other methods return a Promise.
Instead of a Promise, would it make sense to yield more responses and have an async generator instead? Blog post on this: http://thecodebarbarian.com/async-generator-functions-in-javascript.html
That could be the default return type for all the functions. This way, you can always request more stations, and the function should always keep looking for more entities.
That’s the approach we take in Planner.js
This would a cool step to further unify different API endpoints & data sets!
Cool work! In stations.all you implement a readable, and all other methods return a Promise.
Instead of a Promise, would it make sense to yield more responses and have an async generator instead? Blog post on this: http://thecodebarbarian.com/async-generator-functions-in-javascript.html
That could be the default return type for all the functions. This way, you can always request more stations, and the function should always keep looking for more entities.
That’s the approach we take in Planner.js