I know the code I have developed (see below) can be achieved with the
use of link:chain as a request option, but at the time I wrote it, I
didn't realise you could change the url of a Request.  I have a case
where it is guaranteed to chain (I call the function callRequest
inside the onCompletion function of a request) and in Google Chrome it
stopped working.  I decided to upgrade to mootools 1.3, and now it
doesn't work at all in Firefox either (although I also have an
upgraded version of Firefox - v4).

The problem is related to the the parameters of the chained function,
in that when it is called from the chain they are all undefined.  The
code is below and I suspect the problem is related to my use of
auguments.callee and bind - could someone tell me what I am doing
wrong

        Queue: new Class({
            initialize: function(myURL) {
                this.pageURL = myURL;
                this.queue = new Chain();
                this.running = false;
                this.requests = {};
                this.reCall = null;
            },

            callRequest:function (myUrl,myParams,bind,myCallback) {
                var that = this;
                if(this.requests[myUrl] == undefined) {
                    this.requests[myUrl] = new Request ({
                        url:myUrl,
                        onSuccess: function(html) {
                            var holder = new
Element('div').set('html',html);
                            if (holder.getElement('error')) {
 
alert(holder.getElement('error').get('text'));
                                window.location = that.pageURL;
                            } else {
                                that.reCall(holder);
                                that.running = false;
                                that.queue.callChain();
                            }
                        }
                    });

                }
                if (this.running) {
                    this.queue.chain(arguments.callee.bind(this,
[myUrl,myParams,bind,myCallback]));
                } else {
                    this.running = true;
                    var calling = myCallback.bind(bind)
                    this.reCall = calling;
                    this.requests[myUrl].post(myParams);
                }
            }
        })

Reply via email to