[mochikit] Re: Using Mochikit with my Classes - Looking for Beginner Documentation
On May 26, 2006, at 2:03 AM, Johan Sundström wrote: I then tried: doSimpleXMLHttpRequest(pathtoxml).addCallback( MyA.cleanXML ); MyA.cleanXML won't carry MyA along as the this object. Try bind( MyA.cleanXML, MyA ) instead of plain MyA.cleanXML. (Untested; I hope I got the parameter order right there.) That is correct. If bindMethods(this) is used in the constructor of ClassA, then the bind call is unnecessary since it's already done when the object is constructed. -bob --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups MochiKit group. To post to this group, send email to mochikit@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/mochikit -~--~~~~--~~--~--~---
[mochikit] Re: Using Mochikit with my Classes - Looking for Beginner Documentation
mochikit doesn't feature a class-emulation kit per se, as other frameworks does. personally i think this is a good thing. I use a variant of the technique described here: http://www.itsalleasy.com/2006/02/24/classjs-third-time-is-the-charm/ For some reading/discussion on the subject, I suggest you take a look at this post (in particular the comments) : http://www.sitepoint.com/blogs/2006/01/17/javascript-inheritance/ On 5/25/06, Will [EMAIL PROTECTED] wrote: Hi, I've been using Mochikit for some time to do simple stuff, but I am now trying to work it into my prototypes (small p)/classes, but the I am having some trouble with what this references, and it also seems like there are a whole bunch of tools to make building classes easier, but I am definitely lost. So I was wondering, rather than trouble you with some little example, maybe I can read up on suggested ways of building classes using Mochikit. Is there some documenation on this for mid-advance js writers? I'm looking for a good starting point. Thanks! -- troels --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups MochiKit group. To post to this group, send email to mochikit@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/mochikit -~--~~~~--~~--~--~---
[mochikit] Re: Using Mochikit with my Classes - Looking for Beginner Documentation
On May 25, 2006, at 9:33 PM, Will wrote: I've been using Mochikit for some time to do simple stuff, but I am now trying to work it into my prototypes (small p)/classes, but the I am having some trouble with what this references, and it also seems like there are a whole bunch of tools to make building classes easier, but I am definitely lost. So I was wondering, rather than trouble you with some little example, maybe I can read up on suggested ways of building classes using Mochikit. Is there some documenation on this for mid-advance js writers? I'm looking for a good starting point. MochiKit doesn't really provide any specific way to create constructors, as it really doesn't use them much internally. The pattern used internally is to define the constructor, then do an update() on the prototype to add methods. As for this troubles, you'll want to take a look at bind, method, and bindMethods. You should also read up on JavaScript so that you understand how and why it's doing what it does. I've written up a bit on that particular issue here: http://tinyurl.com/ak5xs -bob --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups MochiKit group. To post to this group, send email to mochikit@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/mochikit -~--~~~~--~~--~--~---
[mochikit] Re: Using Mochikit with my Classes - Looking for Beginner Documentation
Thanks for both of these posts. Off to read. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups MochiKit group. To post to this group, send email to mochikit@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/mochikit -~--~~~~--~~--~--~---
[mochikit] Re: Using Mochikit with my Classes - Looking for Beginner Documentation
Know what? I'm glad to say that after reading through the links, I think I am already pretty much up to speed on most things discussed. Some of the fancier construction techniques, those trying to address multiple inheritance were advanced. But I'm familiar with prototype object construction and standard js inheritance. I did very much enjoy the this testing Bob as it gave nice clear examples of what I've experienced. So maybe my problem actually is not so serious and is more related to the Mochikit AJAX method I am using. So, please indulge my real world hang up... What prompted my post was trouble with trying to pass a method of an object instance to addCallback() of doSimpleXMLHttpRequest(pathtoxml) -- and this returning [object Window] instead of the reference to the instance. In other words, assume: function ClassA(){ this.xml; } ClassA.prototype.cleanXML = function(rslt){ this.xml = rslt...; }; MyA = new ClassA(); I then tried: doSimpleXMLHttpRequest(pathtoxml).addCallback( MyA.cleanXML ); The this inside MyA.cleanXML in this case points to window, because I guess what is going on is the method is being copied. So is there a way to do this staying inside my object? So I don't have to have a external function that then populates MyA.xml? Thanks again!! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups MochiKit group. To post to this group, send email to mochikit@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/mochikit -~--~~~~--~~--~--~---
[mochikit] Re: Using Mochikit with my Classes - Looking for Beginner Documentation
I then tried: doSimpleXMLHttpRequest(pathtoxml).addCallback( MyA.cleanXML ); MyA.cleanXML won't carry MyA along as the this object. Try bind( MyA.cleanXML, MyA ) instead of plain MyA.cleanXML. (Untested; I hope I got the parameter order right there.) -- / Johan Sundström, http://ecmanaut.blogspot.com/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups MochiKit group. To post to this group, send email to mochikit@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/mochikit -~--~~~~--~~--~--~---