Skip to content

Instantly share code, notes, and snippets.

@heapwolf
Created August 6, 2012 16:19
Show Gist options
  • Save heapwolf/3276106 to your computer and use it in GitHub Desktop.
Save heapwolf/3276106 to your computer and use it in GitHub Desktop.
js/inherit
function A() {
console.log('a constructor');
this.a = 'a';
};
function B() {
A.call(this);
console.log('b constructor');
this.b = 'b';
};
var b = new B();
// a constructor
// b constructor
b.a // 'a';
b.b // 'b';
@heapwolf
Copy link
Author

heapwolf commented Aug 6, 2012

var myEmitter = new MyClass();

myEmitter.on('myEventType', function(arg1, arg2) {
console.log(arg1, arg2);
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment