Chain has 2 main methods and you have to use both in order for it to do
anything:
chain - pushes a function onto the stack
callChain - calls the next function on the stack
so if you want to do:
this.fn1().chain(this.fn2.bind(this));
then fn1 has to have this in it:
fn1: function(){
...some logic that you want to execute
this.callChain();
return this;
}
On Sun, Apr 26, 2009 at 6:17 PM, nwhite (via Nabble) <
[email protected]<ml-user%[email protected]>
> wrote:
>
> if(this.options.preload){
> new Asset.images(['/images/myImage.png', '/images/myImage2.gif'], {
>
>
> onComplete: this.setUp
> });
> }
>
>
>
> On Sun, Apr 26, 2009 at 6:06 PM, mmjaeger
> <mmjae...@...<http://n2.nabble.com/user/SendEmail.jtp?type=node&node=2721298&i=0>
> > wrote:
>
>>
>> I'm not sure whether that would work.
>>
>> the following code actually does work but I hopped there is an easier
>> way to do it:
>>
>> /*
>>
>> if (this.options.preload) {
>> var callback = new Chain();
>> this._preload(callback);
>> callback.chain (
>> function() {
>> this.setUp();
>> }.bind(this)
>> )
>> } else {
>> this.setUp();
>> }*/
>>
>> On Apr 26, 5:17 pm, "asgaroth.belem"
>> <asgaroth.be...@...<http://n2.nabble.com/user/SendEmail.jtp?type=node&node=2721298&i=1>>
>> wrote:
>> > I think all you have to do is (not sure, sorry for any mistakes):
>> >
>> > this.function1().chain(this.function2());
>> >
>> > thats what chain is for, it wont execute function2 until function 1
>> > has ended. at least is what I think, i dont really use chain much.
>> >
>> > On 26 abr, 18:38, mmjaeger
>> > <mmjae...@...<http://n2.nabble.com/user/SendEmail.jtp?type=node&node=2721298&i=2>>
>> wrote:
>> >
>> > > Hello
>> > > Hope somebody can help - I'm struggling with chaining two functions
>> >
>> > > this is the code I got:
>> >
>> > > this.function1().chain(
>> > > function() {
>> > > this.function2();
>> > > }
>> > > );
>> >
>> > > function1 has an onComplete event - like this:
>> >
>> > > I put the following in there:
>> >
>> > > onComplete: function() {
>> > > this.callChain();
>> >
>> > > }
>> >
>> > > function1 is basically a function to preload some image - when they
>> > > are loaded, I like to continue to execute function2.
>> >
>> > > Thank you in advance for your help.
>> >
>> > > What am I missing?
>>
>
>
>
> ------------------------------
> View message @
> http://n2.nabble.com/-Moo--Struggling-with-chain-tp2721028p2721298.html
> To start a new topic under MooTools Users, email
> [email protected]<ml-node%[email protected]>
> To unsubscribe from MooTools Users, click here< (link removed) >.
>
>
>
-----
The MooTools Tutorial: http://www.mootorial.com www.mootorial.com
Clientcide: http://www.clientcide.com www.clientcide.com
--
View this message in context:
http://n2.nabble.com/-Moo--Struggling-with-chain-tp2721028p2721347.html
Sent from the MooTools Users mailing list archive at Nabble.com.