Skip to content

Instantly share code, notes, and snippets.

@jakearchibald
Created October 21, 2009 15:41
Show Gist options
  • Save jakearchibald/215195 to your computer and use it in GitHub Desktop.
Save jakearchibald/215195 to your computer and use it in GitHub Desktop.
function Ball(colour) {
// ...
}
Ball.prototype.on = function(eventName, callback) {
glow.events.addListener(this, eventName, callback);
};
Ball.prototype._moved = function() {
if (this._directionChange) {
glow.events.fire(this, 'bounce');
}
};
// usage:
var redBall = new Ball('#f00');
redBall.on('bounce', function() {
console.log('Red ball bounced');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment