I agree. I had to write my own code do do stuff like you describe. Event.__observe = Event.observe; Event.observe = function(element, name, observer, useCapture, observe) { observe = (typeof(observe) == 'undefined' ? true : observe); return new Event.Observer(element, name, observer, useCapture, observe); };
Event.Observer = function (element, name, observer, useCapture, observe){ this.element = element; this.name = name; this.observer = observer; this.useCapture = useCapture; observe ? this.start() : this.stop(); /* prevent memory leaks in IE */ if (Prototype.Browser.IE){ Event.__observe(window, 'unload', Event.unloadObserver.bindAsEventListener(Event, this)); } }; Event.unloadObserver = function(observer){ observer.element = null; observer.observer = null; }; Event.Observer.prototype = new function(){ this.stop = function(){ if (!this.observe){ return; } Event.stopObserving(this.element, this.name, this.observer, this.useCapture); this.observe = false; }; this.start = function(){ if (this.observe){ return; } Event.__observe(this.element, this.name, this.observer, this.useCapture); this.observe = true; }; }; So now I can do this var observer = Event.observe( ... ); observer.stop(); observer.start(); --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Prototype: Core" group. To post to this group, send email to prototype-core@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~----------~----~----~----~------~----~------~--~---