I uses a same technique (observer pattern) for my menu. You define
listeners within each button scope. Don't mind missing images.. this is
an older version :) 

http://www.mschopman.demon.nl/menu/
http://www.mschopman.demon.nl/menu/config.xml


observers = [];
function observer(){
        this.listeners = [];
        observers.push(this);
}
observer.prototype.notify = function(){
        var i=this.listeners.length;while(i--){
                this.listeners[i].notify();
        }
}
observer.prototype.attach = function(oListener){
        this.listeners.push(oListener);
}
observer.prototype.detach = function(){
        
}
obsOnNodeSelect = new observer();



Micha Schopman
Project Manager

Modern Media, Databankweg 12 M, 3821 AL  Amersfoort
Tel 033-4535377, Fax 033-4535388
KvK Amersfoort 39081679, Rabo 39.48.05.380

------------------------------------------------------------------------
------------------------------------------------------------------------
-----
Modern Media, Making You Interact Smarter. Onze oplossingen verbeteren
de interactie met uw doelgroep. 
Wilt u meer omzet, lagere kosten of een beter service niveau? Voor meer
informatie zie www.modernmedia.nl 
------------------------------------------------------------------------
------------------------------------------------------------------------
-----

-----Original Message-----
From: Scott Barnes [mailto:[EMAIL PROTECTED] 
Sent: donderdag 31 maart 2005 13:31
To: CF-Talk
Subject: Re: What's wrong with the Javascript?

Ditto,

A simple listener/queue system would be suitable here vs looping over
every element.

Personally i'd rather write a listener that waits for an onChange
event and adds the id of that element to a queue (marking it as
dirty), then when i need to process that information, it iterates over
that queue and carrys out taskXYZ accordingly, each time slicing the
currentItem from the queue (in the event more items get added...which
is pretty damn rare).

Intervals + looping can be a pretty damn scarey if not used correctly
and come with a big ol warning "use wisely". As its perfect breeding
ground for some nasty Memory Leaks for one - that and can be costly in
terms of assuming every cycle runs smoothley (ie no time outs etc).

thats my hot tip for the day ehhehehe.


-- 
Regards,
Scott Barnes
http://www.mossyblog.com
http://www.flexcoder.com (Coming Soon)



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:200945
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to