On 8/18/06, fimi <[EMAIL PROTECTED]> wrote: > now the bind method seems to bind the saveData function with > 'this'..... which is throwing me off because it's a method of the > Class, and i thought it has access to its members.
JavaScript is somewhat different to other OO languages in this respect - when passing closures around, the "this" keyword is not always bound as you expect. This is a common confusion point, esecially when dealing with callbacks and event handlers MochiKit has a convenience function in the Base module called bindMethods. You can use this methods in your constructor by calling "bindMethods(this)" - which basically calls bind(this.method, this) for every methods in the prototype. This way you should get expected behaviour and don't have to worry about "this". Arnar --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---