adding an option to delete arbitrary operations

This commit is contained in:
DadaMonad
2015-01-21 00:51:26 +00:00
parent 672696ef86
commit d93aa8a2ba
8 changed files with 50 additions and 17 deletions

View File

@@ -59,6 +59,10 @@ module.exports = (HB)->
deleteAllObservers: ()->
@event_listeners = []
delete: ()->
(new types.Delete undefined, @).execute()
null
#
# Fire an event.
# TODO: Do something with timeouts. You don't want this to fire for every operation (e.g. insert).

View File

@@ -127,7 +127,8 @@ module.exports = (HB)->
o = @beginning.next_cl
result = []
while o isnt @end
result.push o.val()
if not o.isDeleted()
result.push o.val()
o = o.next_cl
result
@@ -183,7 +184,7 @@ module.exports = (HB)->
break
d = (new types.Delete undefined, o).execute()
o = o.next_cl
while not (o instanceof types.Delimiter) and o.isDeleted()
while (not (o instanceof types.Delimiter)) or o.isDeleted()
o = o.next_cl
delete_ops.push d._encode()
@