Created
October 18, 2014 20:00
-
-
Save brendanashworth/ebce0ce62b842fd08e4d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Cat.prototype.meow = function(message) { | |
this.emit('meow', message); | |
} | |
// Create a cat | |
var kitty = new Cat('Mittens'); | |
kitty.on('meow', function(msg) { | |
console.log('We got a message from Mittens:', msg); | |
}); | |
kitty.meow('Purrrr'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment