That's quite confusing : )
You obtain "Test" like so:
t.t2.callback.call(t)
- kangax
On May 10, 1:52 pm, Thomas <[EMAIL PROTECTED]> wrote:
> hello
>
> I have a problem with the following code :
>
> var Test = Class.create({
> data:"Test",
> initialize: function() {
> this.t2 = new Test2(this.callt1);
> },
> callt1: function(){
> alert(this.data);
> }
>
> });
>
> var Test2 = Class.create({
> data: "Test2",
> initialize: function(callback) {
> this.callback=callback;
> },
> callt2: function(){
> this.callback();
> }
>
> });
>
> var t = new Test();
>
> t.t2.callt2();
>
> I get "Test2" but I'm wait for "Test". I think it is not a bug but how
> can I do to obtain "Test"
>
> Thomas
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---