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
Ideally, we want to keep cola.next as data-format-agnostic as possible, and currently it does a pretty good job, since we rely on a datasource's metadata descriptor to help us interact with the data. One place we haven't covered yet is an observer that needs to consume a collection of data from any datasource ... for example, a bard view.
For example, datasource.fetch() may return anything it wants ... an Array, a backbone Collection, a promise for any of the above, etc. So, an observer who wants to be able consume data from any datasource can't know what it will receive.
Here are a couple ideas:
Specify a minimal API that any collection must implement
Add an API to the metadata descriptor
In either case, the API could be something super-simple like either a forEach() method, or an iterator() method which returns an ES6-like { next: function() } iterator. Both of those allow streaming and asynchrony, so they seem flexible enough. Streaming is trickier with iterators since they are pull-based, but they do facilitate lazy evaluation a bit more easily, which could be good.
The text was updated successfully, but these errors were encountered:
Ideally, we want to keep cola.next as data-format-agnostic as possible, and currently it does a pretty good job, since we rely on a datasource's metadata descriptor to help us interact with the data. One place we haven't covered yet is an observer that needs to consume a collection of data from any datasource ... for example, a bard view.
For example,
datasource.fetch()
may return anything it wants ... an Array, a backbone Collection, a promise for any of the above, etc. So, an observer who wants to be able consume data from any datasource can't know what it will receive.Here are a couple ideas:
In either case, the API could be something super-simple like either a
forEach()
method, or aniterator()
method which returns an ES6-like{ next: function() }
iterator. Both of those allow streaming and asynchrony, so they seem flexible enough. Streaming is trickier with iterators since they are pull-based, but they do facilitate lazy evaluation a bit more easily, which could be good.The text was updated successfully, but these errors were encountered: