function Something() { goog.events.EventHandler.call(this); ... set up object ... // Add event listeners this.listen(this.starEl, 'click', this.handleStar); this.listen(this.headerEl, 'click', this.expand); this.listen(this.collapseEl, 'click', this.collapse); this.listen(this.infoEl, 'mouseover', this.showHover); this.listen(this.infoEl, 'mouseout', this.hideHover); } goog.inherits(Something, goog.events.EventHandler); Something.prototype.disposeInternal = function() { Something.superClass_.disposeInternal.call(this); goog.dom.removeNode(this.container); }; // Then elsewhere: var activeSomething = null; function openSomething() { activeSomething = new Something(); } function closeSomething() { if (activeSomething) { activeSomething.dispose(); // Remove event listeners activeSomething = null; } }
Initial count for the keyPool_
|
Code » | |
Max count for the keyPool_
|
Code » | |
SimplePool to cache the key object. This was implemented to make IE6
performance better and removed an object allocation in the listen method
when in steady state.
|
Code » | |
Keys for event that is being listened to if only one event is being listened
to. This is a performance optimization to avoid creating an extra object
if not necessary.
|
Code » | |
Keys for events that are being listened to. This is used once there are more
than one event to listen to. If there is only one event to listen to, key_
is used.
|
Code » |