1 module.exports = Stream;
3 var Parser = require("./WritableStream.js");
5 function Stream(options) {
6 Parser.call(this, new Cbs(this), options);
9 require("inherits")(Stream, Parser);
11 Stream.prototype.readable = true;
17 var EVENTS = require("../").EVENTS;
19 Object.keys(EVENTS).forEach(function(name) {
20 if (EVENTS[name] === 0) {
21 Cbs.prototype["on" + name] = function() {
22 this.scope.emit(name);
24 } else if (EVENTS[name] === 1) {
25 Cbs.prototype["on" + name] = function(a) {
26 this.scope.emit(name, a);
28 } else if (EVENTS[name] === 2) {
29 Cbs.prototype["on" + name] = function(a, b) {
30 this.scope.emit(name, a, b);
33 throw Error("wrong number of arguments!");