Skip to content
Browse files

event emitter example

  • Loading branch information...
1 parent 4f6d00e commit 65bab9d8b9caae3ec121069f6207b8b17a902f10 @substack committed Nov 9, 2011
Showing with 20 additions and 0 deletions.
  1. +20 −0 example/ev.js
View
20 example/ev.js
@@ -0,0 +1,20 @@
+var gutter = require('../');
+
+var EventEmitter = require('events').EventEmitter;
+var stream = new EventEmitter;
+
+var out = gutter({
+ name : 'greetings',
+ version : '1.2.3',
+ greetings : stream,
+ beep : 'boop'
+});
+out.pipe(process.stdout);
+
+var ix = 0;
+var iv = setInterval(function () {
+ if (++ix === 4) clearInterval(iv)
+ else {
+ out.emit('data', ix);
+ }
+}, 200);

0 comments on commit 65bab9d

Please sign in to comment.
Something went wrong with that request. Please try again.