On Oct 30, 9:24 am, darrinholst <[EMAIL PROTECTED]> wrote:
> > How can I define "private" methods for tabs function, so that onclick
> > event handler can use this "private" function, instead of anonymous
> > one?
>
> Is this what you're looking for?
>
> Object.extend(Element.Methods, {
>     tabs: function(element, options){
>       var saySomething = function() {
>         alert("blah");
>       }

I wouldn't recommend this. Instead of creating a function object every
time `tabs' method is called, it would make more sense to declare a
function outside of the `tabs' body, but in such way that its body
would have "helper" function in its scope:

Element.addMethods({
  tabs: (function() {
    function private() { };
    return function() {
      // use `private' function here
    };
  })();
});

or structured differently (if that makes things clearer):

(function(){
  function private(){};
  Element.addMethods({
    tabs: function(){
      // use `private' function here
    }
  })
})();

[snip]

--
kangax
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to