From 06c0d7b216bbf0f665db52ea8a22278c7b486697 Mon Sep 17 00:00:00 2001 From: Naomi Seyfer Date: Fri, 25 Jan 2013 16:09:04 -0800 Subject: [PATCH] Undoing David comments to spark, probably not switching over to OC --- packages/spark/spark.js | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/packages/spark/spark.js b/packages/spark/spark.js index 58756215cf..866c64db09 100644 --- a/packages/spark/spark.js +++ b/packages/spark/spark.js @@ -892,18 +892,15 @@ Spark.list = function (cursor, itemFunc, elseFunc) { }); // Get the current contents of the cursor. - - // TODO: unify initialContents and itemRanges into one - // OrderedDict from id -> (doc, LiveRange), called - // `itemDict`. + // XXX currently we count on observe() using only added() to deliver + // the initial contents. are we allow to do that, or do we need to + // implement removed/moved/changed here as well? var initialContents = []; _.extend(callbacks, { added: function (item, beforeIndex) { - // TODO: itemDict.addBefore ... initialContents.splice(beforeIndex, 0, item); } }); - // TODO: observeChanges var handle = cursor.observe(observerCallbacks); // Get the renderer, if any @@ -917,18 +914,15 @@ Spark.list = function (cursor, itemFunc, elseFunc) { // off for later. var html = ''; var outerRange; - // TODO: itemRanges is a map from id to LiveRange var itemRanges = []; if (! initialContents.length) html = elseFunc(); else { - // TODO: iterate over itemDict for (var i = 0; i < initialContents.length; i++) { (function (i) { html += maybeAnnotate(itemFunc(initialContents[i]), Spark._ANNOTATION_LIST_ITEM, function (range) { - // TOOD: mutate value in itemDict itemRanges[i] = range; }); })(i); // scope i to closure