Skip to content

Instantly share code, notes, and snippets.

@Unitecho
Created March 9, 2013 08:59
Show Gist options
  • Save Unitecho/5123554 to your computer and use it in GitHub Desktop.
Save Unitecho/5123554 to your computer and use it in GitHub Desktop.
streams
var __ = require("../maki/lib/underscore.js");
var events = require("events");
var Stream = require('./events_caller.js').MyStream;
var stream = new Stream();
console.log(stream instanceof events.EventEmitter); // true
console.log(Stream.super_ === events.EventEmitter); // true
stream.on("data", function(data) {
console.log('Received data: "' + data + '"');
})
console.log('Available methods for stream (from within) : '+ __.functions(stream));
stream.write("It works!"); // Received data: "It works!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment