Permalink
Browse files

Fixed up example to work again... Also fixed and updated lib to use s…

…tartNext instead of just next.

Signed-off-by: Nick Campbell <nicholas.j.campbell@gmail.com>
  • Loading branch information...
1 parent d666ecb commit 7f4a3d45222cdb229559f4ddf4a9942d86d23b30 @ncb000gt committed Sep 28, 2011
Showing with 15 additions and 9 deletions.
  1. +13 −7 examples/test.js
  2. +2 −2 lib/queuestream.js
View
@@ -1,21 +1,27 @@
var Queue = require('../lib/queuestream').QueueStream(),
fs = require('fs');
-stream.on('error', function(err) {
+Queue.on('error', function(err) {
console.log('err: ' + err);
});
-stream.on('data', function(data) {
- console.log(data.toString());
+Queue.on('data', function(data) {
+ console.log('listener 1: ' + data.toString());
+});
+Queue.on('data', function(data) {
+ console.log('listener 2: ' + data.toString());
+});
+Queue.on('data', function(data) {
+ console.log('listener 3: ' + data.toString());
});
-stream.on('end', function() {
+Queue.on('end', function() {
console.log('done');
});
var test1 = fs.createReadStream(__dirname + '/files/test1.txt');
-stream.queue(test1);
+Queue.queue(test1);
var test2 = fs.createReadStream(__dirname + '/files/test2.txt');
-stream.queue(test2);
+Queue.queue(test2);
-stream.start();
+Queue.startNext();
View
@@ -73,7 +73,7 @@ QueueStream.prototype.start = function() {
if (this.current.paused) this.current.resume();
} else if (this.streams.length > 0) {
- this.next();
+ this.startNext();
}
}
@@ -117,7 +117,7 @@ QueueStream.prototype.end = function() {
// Handle currentStream Events
QueueStream.prototype.currentEnd = function() {
this.current = null;
- this.next();
+ this.startNext();
}
QueueStream.prototype.currentData = function(data) {

0 comments on commit 7f4a3d4

Please sign in to comment.