You may want to check OpenRICO - http://openrico.org
Cheers, On 8/19/05, David Durham <[EMAIL PROTECTED]> wrote: > Hi -- > > There's been some traffic on this list involving XMLHttpRequests and > javascript, and since it's Friday ... > > My problem: How to use multiple asynchronous requests simultaneously > without using the global namespace. For instance, I'd like to create a > little DirectoryTree widget that I can drop in pages like so: > > <script type="text/javascript"> > new DirectoryTree("some_directory_name"); > </script> > > Ideally, I could drop as many of these widgets on the page as I want. > > Then I have some javascript like so: > > DirectoryTree = function(directory, url) { > //setup > ... > execute(url, DefaultCallback); > } > > Here's an execute method that supposed to trigger some kind of action: > > execute(url, callback) { > var cb = new callback(); > cb.request = new XMLHttpRequest(); > cb.request.onreadystatechange = callback.processResponse; > cb.request.open(this.METHOD, url, this.ASYNC); > cb.request.send(null); > } > > DefaultCallback = function() { > this.request = null; > > function processResponse() { > log.info("decorating: " + this.request); > } > } > > > The processResponse() method alerts: "decorating: undefined". I even > tried: > > DefaultCallback = function() { > this.request = null; > } > > DefaultCallback.processResponse = function() { > log.info("decorating: " + this.request); > } > > and got the same result. > > I'm somewhat experienced with Javascript and it's OO concepts and event > handling, but not terribly so. I think what's happening here is that on > readystate change triggers the creation of a new > 'DefaultCallback.processResponse' object and therefore a new scope with > no concept of the 'var cb = new callback()' scope. Therefore, in order > to get at the xmlrequest/response, I need to go through the global > namespace or some other static-like namespace, which I don't really want > to do because I'd like to avoid managing, say a queue of xml http > requests. I haven't looked through the xml http request stuff that was > posted to struts sandbox (I think it's in sandbox, not really sure), but > does anyone have ideas on this one, or can point me to some code or info > with solution(s)? > > > - Dave > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]