tnhu / jsface

Small, fast, elegant, powerful, and cross platform JavaScript OOP library. Support main(), singleton, super call, private, mixins, plugins, AOP and more.
MIT License
301 stars 46 forks source link

$ready works incorrectly #4

Closed tnhu closed 12 years ago

tnhu commented 12 years ago
var App = Class({
    $ready: function(clazz, api, parent) {
      var fromSubClass = (this !== clazz);

      console.log(this !== clazz);

      if (fromSubClass) {
        api.main.call(clazz);
      }
    }
  });

var Foo = Class(App, {
   constructor: function(foo) { this.foo = foo; },
   main: function() {
      console.log(new Foo("heloo").foo);
   }
});

main is not executed in App's context.