collection iterator is now async, it needs to run the new record's download filter

This commit is contained in:
Dan Mills 2008-11-25 14:46:18 +09:00
parent fb99c9f85e
commit 69074b307e

View File

@ -137,13 +137,20 @@ CollectionIterator.prototype = {
get count() { return this._coll.data.length; }, get count() { return this._coll.data.length; },
next: function CollIter_next() { next: function CollIter_next(onComplete) {
if (this._idx >= this.count) let fn = function CollIter__next() {
return null; let self = yield;
let item = this._coll.data[this._idx++];
let wrap = new CryptoWrapper(this._coll.uri.resolve(item.id)); if (this._idx >= this.count)
wrap.data = item; return;
return wrap; let item = this._coll.data[this._idx++];
let wrap = new CryptoWrapper(this._coll.uri.resolve(item.id));
wrap.data = this._coll._json.encode(item); // HACK HACK HACK
yield wrap.filterDownload(self.cb); // XXX EEK
self.done(wrap);
};
fn.async(this, onComplete);
}, },
reset: function CollIter_reset() { reset: function CollIter_reset() {