Prototype 1.6.2 with Static support

Description:

This simple extension to the Prototype JavaScript library allows you to define static methods for your classes. See code below. The $super argument can be used to call super classes as well

Code:

    Animal = Class.create({
      initialize: function() {
        document.write("Animal constructor called!")
      },
  
      imethod: function() {
        document.write("Instant method from Animal called");
      },
  
      $static: {
        smethod: function() {
          document.write("Static method from Animal called")
        }
      }
    });

    Human = Class.create(Animal, {
      initialize: function($super) {
        $super()
        document.write("Human constructor called!")
      }
    });

    Developer = Class.create(Human, {
      initialize: function($super){
        document.write("Developer constructor called!")
        $super()
      },

      $static: {
        smethod: function($super) {
          document.write("Static smethod called from Developer")
          $super()
        },
        
        smethod2: function() {
          document.write("Static smethod2 called from Developer")
        }
      }
    });

    a = new Animal()  
    h = new Human()
    d = new Developer()
    
    a.imethod()
    h.imethod()
    d.imethod()

    Developer.smethod2()

    Human.smethod()    
    Animal.smethod()
    Developer.smethod()
  

Test results: