Skip to content

Commit

Permalink
Improve ActiveStream
Browse files Browse the repository at this point in the history
  • Loading branch information
srdanrasic committed Nov 15, 2015
1 parent c86dce9 commit 9743ada
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion ReactiveKit/Streams/ActiveStream.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ public class ActiveStream<Event>: ActiveStreamType {
self.selfReference = tmpSelfReference
}

public init(limit: Int = 0) {
self.buffer = StreamBuffer(limit: limit)
let tmpSelfReference = Reference(self)
tmpSelfReference.release()
self.selfReference = tmpSelfReference
}

public func observe(sink: Sink) -> DisposableType {
return observe(on: ImmediateExecutionContext, sink: sink)
}
Expand Down Expand Up @@ -89,7 +96,7 @@ public class ActiveStream<Event>: ActiveStreamType {
return try buffer.last()
}

internal func next(event: Event) {
public func next(event: Event) {
buffer.next(event)
dispatchNext(event)
}
Expand Down

0 comments on commit 9743ada

Please sign in to comment.