Make evented Objects in JavaScript