P
ROTOTYPE
I'm Not Only The Prototype, I'm Also A Member.
home
▪
stats
▪
search
▪
linkback
▪
about
▪
FAQ
| user: guest,
login
,
register
ASBroadcaster
:
disableListeners/enableListeners
author:
Covenent
[+]
,
Submitted: 07.05.03 2p
// disables objects current listeners so it cant send events to them Object.prototype.disableListeners = function () { // store old listeners this.$_listeners = this._listeners; // clear listeners array this._listeners = []; } // enables objects listeners Object.prototype.enableListeners = function () { // set listeners back to previous state this._listeners = (this.$_listeners == null) ? this._listeners : this.$_listeners; }
usage
(I know this is an Object prototype, but its more related to ASBroadcaster so I posted it here.) A very simple prototype for disabling/enabling listeners. I found this particularly useful when creating my own Classes, as I might have add a method that automatically triggered an event; but sometimes I would want to call the method without triggering the event. It seemed wasteful to pass additional arguments to the method and use if statements, so I wrote this instead.
Add Comment
[+]
›opyleft 2001-2013. Layer51 is: Jaime Prado.
@
buy wow gold
abendkleider online
cocktail dresses uk
woolrich outlet
clarisonic pro
long prom dresses