Sha256: 3d2f291e35f7aee32aa3ed5d1bb948141cf618d8b727d0c7eff6e005aeafca9a

Contents?: true

Size: 730 Bytes

Versions: 19

Compression:

Stored size: 730 Bytes

Contents

module.exports = Stream;

var Parser = require("./WritableStream.js");

function Stream(options){
	Parser.call(this, new Cbs(this), options);
}

require("inherits")(Stream, Parser);

Stream.prototype.readable = true;

function Cbs(scope){
	this.scope = scope;
}

var EVENTS = require("../").EVENTS;

Object.keys(EVENTS).forEach(function(name){
	if(EVENTS[name] === 0){
		Cbs.prototype["on" + name] = function(){
			this.scope.emit(name);
		};
	} else if(EVENTS[name] === 1){
		Cbs.prototype["on" + name] = function(a){
			this.scope.emit(name, a);
		};
	} else if(EVENTS[name] === 2){
		Cbs.prototype["on" + name] = function(a, b){
			this.scope.emit(name, a, b);
		};
	} else {
		throw Error("wrong number of arguments!");
	}
});

Version data entries

19 entries across 16 versions & 3 rubygems

Version Path
locomotivecms-4.0.0.alpha1 app/javascript/node_modules/htmlparser2/lib/Stream.js
locomotivecms-3.4.0 app/javascript/node_modules/htmlparser2/lib/Stream.js
lanes-0.8.0 node_modules/htmlparser2/lib/Stream.js
tck-lambdas-0.3.10 lib/tck/lambdas/chistacojs/source/node_modules/cheerio/node_modules/htmlparser2/lib/Stream.js
tck-lambdas-0.3.9 lib/tck/lambdas/chistacojs/source/node_modules/cheerio/node_modules/htmlparser2/lib/Stream.js
tck-lambdas-0.3.8 lib/tck/lambdas/chistacojs/source/node_modules/cheerio/node_modules/htmlparser2/lib/Stream.js
tck-lambdas-0.3.7 lib/tck/lambdas/chistacojs/source/node_modules/cheerio/node_modules/htmlparser2/lib/Stream.js
tck-lambdas-0.3.6 lib/tck/lambdas/chistacojs/source/node_modules/cheerio/node_modules/htmlparser2/lib/Stream.js
tck-lambdas-0.3.5 lib/tck/lambdas/chistacojs/source/node_modules/cheerio/node_modules/htmlparser2/lib/Stream.js
tck-lambdas-0.3.4 lib/tck/lambdas/chistacojs/source/node_modules/cheerio/node_modules/htmlparser2/lib/Stream.js
tck-lambdas-0.3.3 lib/tck/lambdas/chistacojs/source/node_modules/cheerio/node_modules/htmlparser2/lib/Stream.js
tck-lambdas-0.3.2 lib/tck/lambdas/chistacojs/source/node_modules/cheerio/node_modules/htmlparser2/lib/Stream.js
tck-lambdas-0.3.1 lib/tck/lambdas/chistacojs/source/node_modules/cheerio/node_modules/htmlparser2/lib/Stream.js
tck-lambdas-0.3.0 lib/tck/lambdas/chistacojs/source/node_modules/cheerio/node_modules/htmlparser2/lib/Stream.js
tck-lambdas-0.3.0 lib/tck/lambdas/chistacojs/node_modules/cheerio/node_modules/htmlparser2/lib/Stream.js
tck-lambdas-0.2.0 lib/tck/lambdas/chistacojs/node_modules/cheerio/node_modules/htmlparser2/lib/Stream.js
tck-lambdas-0.2.0 lib/tck/lambdas/chistacojs/source/node_modules/cheerio/node_modules/htmlparser2/lib/Stream.js
tck-lambdas-0.1.6 lib/tck/lambdas/chistacojs/source/node_modules/cheerio/node_modules/htmlparser2/lib/Stream.js
tck-lambdas-0.1.6 lib/tck/lambdas/chistacojs/node_modules/cheerio/node_modules/htmlparser2/lib/Stream.js