Skip to content

Commit 2ebad3f

Browse files
authored
Merge pull request #14 from felixSchl/feature/onFinish
Add `onFinish` event
2 parents 0f2b352 + 93130af commit 2ebad3f

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

src/Node/Stream.js

+8
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,14 @@ exports.onEnd = function (s) {
4747
};
4848
};
4949

50+
exports.onFinish = function (s) {
51+
return function (f) {
52+
return function () {
53+
s.on("finish", f);
54+
};
55+
};
56+
};
57+
5058
exports.onReadable = function (s) {
5159
return function (f) {
5260
return function () {

src/Node/Stream.purs

+8
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ module Node.Stream
1313
, setEncoding
1414
, onReadable
1515
, onEnd
16+
, onFinish
1617
, onClose
1718
, onError
1819
, resume
@@ -196,6 +197,13 @@ foreign import onEnd
196197
-> Eff eff Unit
197198
-> Eff eff Unit
198199

200+
-- | Listen for `finish` events.
201+
foreign import onFinish
202+
:: forall w eff
203+
. Writable w eff
204+
-> Eff eff Unit
205+
-> Eff eff Unit
206+
199207
-- | Listen for `close` events.
200208
foreign import onClose
201209
:: forall w eff

0 commit comments

Comments
 (0)