Closed dracupid closed 9 years ago
counter = ->
count = 0
{
drive: -> count++
report: -> console.log count
}
c = counter()
kit.warp '*.js'
.load c.drive
.run('dist')
.then ->
c.report()
You need to think things from another aspect. Maybe the user want to control the report by themselves.
Yes, this is a solution for this example, which is similar with what I'm using now. However, in comparison with Stream, a Transform can always know the end of the stream.
Hmm.., I can't put forward a more powerful use case for no
yet. Closure and then
create more possibilities.
I've added 3 lines of code. You can pull it and try it yourself first, if everything is OK, I may add it to the next version. 9ccb26e2bbf75f5
Passed. Well done!
Is it a good idea to let every drive has a onEnd callback, not only writers. For instance, what if I want to count lines of code? Or is there another way to achieve this?