And [1] is: [1] http://ejohn.org/blog/simple-javascript-inheritance/
On 11/28/12 1:23 PM, "Alex Harui" <aha...@adobe.com> wrote: > > > > On 11/28/12 12:32 PM, "Kevin Newman" <capta...@unfocus.com> wrote: > >> It looks like adobe.js is using the constructor method as a kind of >> marker function, and compiling the actual constructor into the 'init' >> method (which is weird IMHO, since you can inherit from the parent >> constructor, and protect the prototype chain without calling the >> constructor via other means - and many AS3 classes may already >> legitimately be using an init method for other purposes, creating a >> collision). > FWIW, the adobe.js file was cooked up by me. The original engineer did not > include it in the donation and I never saw his version. Based on some > comments in the FalconJS code, I started with the code at [1] and modified > it until it actually did something. So, since I'm a JS newbie I could have > screwed up something, but I'm pretty sure the code at [1] is the correct > starting point for what FalconJS outputs. > > The init() name collision caught me too, but I think it would be easy to > change it so something a bit more obfuscated. >> >> So, the adobe.extend( 'name', SuperRef ) - the SuperRef is the marker >> function, and when you call extend it should be invoking the super >> constructor (line 88 in adobe.js). >> >> For methods, if a method name exists on parent, and also exists on >> child, the extend method is adding a closure, which will preserve, and >> then invoke the parent's method in _super() (line 75 in adobe.js). > As you probably know better than me, the author of [1] is a pretty > well-known JS guru. I haven't looked at his other work like Jquery to see > if he uses this pattern there or has since become a convert to some other > pattern. But for now I have to assume there was some important reason for > every line of the code. Was it just to get instanceof to work? > > I don't really care what the output code looks like, but I do know I don't > have the ability to quickly change the output code so I am working on other > aspects and hoping some other volunteer will do that if so motivated. >> >> I didn't notice any place in the example code where super was invoked >> directly, so I'm not sure how Falcon handles that. > Did you really mean Falcon here or FalconJS? I'm not sure I understood > this. I don't think you can use super from outside the class to skip around > an override like I think you can in C++. >> >> From a quick look anyway. >> >> Kevin N. >> >> >> On 11/28/12 2:54 PM, Daniel Wasilewski wrote: >>> Can any JS savvy person here tell me how according to adobe.js module >>> pattern call super? I just lost my head..., got 3 classes extending >>> each other and the only top one call init(); I am preparing those >>> performance tests for comparison. >>> >>> Dan >> -- Alex Harui Flex SDK Team Adobe Systems, Inc. http://blogs.adobe.com/aharui