I'm having trouble using $super in methods other than initialize.

var Reactor = Class.create({
     initialize: function (name) {
         this.name = name;
     },

     work: function (event) {
         console.log("default " + this.name + " working " +  
Object.toJSON(event) );
     }
});


var ReactorFoo = Class.create(Reactor, {
     initialize: function ($super) {
         $super("Foo");
         this.fooUpdate = {
             peopleStart: null,
             companiesStart: null,
             projectsStart: null,
             changedProjects: [],
             numAlerts: 0
         };
     },

     // redefines the work method
     work: function ($super, event) {
         $super.work(event);

        // do more stuff
     }
});


Creating and calling a Reactor works fine:

     var reactor = new Reactor("foo");
     reactor.work(null);

Creating a reactorFoo works fine:
     var reactorFop = new ReactorFoo();

... but then calling the work method gets a "TypeError: Result of  
expression '$super.work' [undefined] is not a function." error:
     reactorFop.work(null);


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to