                 @closed?()
                 @closed = yes
 
+    onremove: (el) ->
+        el._stream.delete()
+        delete el._stream
+
     onclose: (el) ->
         el._stream.write =>
             unless el.isempty or el is el.builder

            do job

    emit: ->
        @order.emit(arguments...)

    write: (job) ->
        payload = {job, order:(++@children)}

        @emit 'open scope', {order:0}
        @released = yes

    delete: () =>
        @order.removeAllListeners()
        @order.reset()
        @order.clear()
        delete @parent
        delete @order


class StreamAdapter extends Stream # Readable
