Permalink
Browse files

mixin EventEmitter

  • Loading branch information...
1 parent c9ace7e commit c94b1076cd45b1ae471b8c87b89c02e7f1a96dff @aheckmann committed Nov 10, 2012
Showing with 11 additions and 0 deletions.
  1. +11 −0 index.js
View
@@ -5,6 +5,7 @@
*/
var Stream = require('stream').Stream;
+var EventEmitter = require('events').EventEmitter;
/**
* Constructor.
@@ -21,6 +22,8 @@ function gm (source, height, color) {
return new gm(source, height, color);
}
+ EventEmitter.call(this);
+
this._options = {};
this.options(this.__proto__._options);
@@ -65,6 +68,14 @@ function gm (source, height, color) {
});
}
+/**
+ * Mixin EventEmitter
+ */
+
+for (var method in EventEmitter.prototype) {
+ gm.prototype[method] = EventEmitter.prototype[method];
+}
+
var parent = gm;
gm.subClass = function subClass (options) {
function gm (source, height, color) {

0 comments on commit c94b107

Please sign in to comment.