Hi Cequiel,

I've some questions to your problem.

1. Who triggers your events and when are they (supposed) to be dispatched?
2. If anotherevent happens before myevent it will have no effect on
anotherobject. So what is anotherevent for?
3. What do you mean with lock/unlockEvent()?

by(e)
Stephan



2009/2/3 Cequiel <gonzalo.chumil...@gmail.com>:
>
> Hi everybody,
>
> I have the next silly problem:
>
> $(myobject).bind('myevent', function() {
>  var anotherobject = new MyCustomObject();
>  $(anotherobject).bind('anotherevent', function() {
>    // code here
>  });
> });
>
> and then I write these two lines:
>
> $(myobject).trigger('myevent');
> $(myobject).trigger('myevent');
>
> The problem is that sometimes 'myevent' is dispatched before the
> 'anotherevent' and I would like to be sure that the 'anotherevent' has
> been dispached previously. I'm thinking in something like this:
>
> $(myobject).bind('myevent', function() {
>
>  // here we lock 'myevent'
>  $(myobject).lockEvent('myevent);
>
>  var anotherobject = new MyCustomObject();
>  $(anotherobject).bind('anotherevent', function() {
>    // code here
>
>    // here we unlock 'myevent' so we are sure 'myevent' is dispached
> after the 'anotherevent'
>    $(myobject).unlockEvent('myevent');
>  });
> });
>
> I now it is a strange question :) and I currently I'm doing it in
> another way, but I'm curios about it.
>
> Thank you in advance and sorry for my English.
>

Reply via email to