ok so I'm a little confused.  Ive read through several articles about
namespacing and I've looked over several plugins to get a feel for the
structure.  The plugins for reference are cluetip and cycle.

So it looks like there are 2 ways to go about namespacing.  Version A
or B?  Is there any reason to use one over the other?  Any help with
clarifying greatly appreciate!

Version A

$.fn.myNamespace = function(){

        return this.each(function(i){

                dosomething;
        });

};

$.fn.myNamespace.outerFunc1 = function(){

        // insert code
        var innerfunc = function(){
                // function only for outerFunc1
        }


}

$.fn.myNamespace.outerFunc2 = function(){

        // insert code
        var innerfunc2 = function(){
        }


}

Version B

$.myNamespace = ({

        outerFunc1:function(){

                // insert code
                var innerfunc = function(){
                        // function only for outerFunc1
                }

        },

        outerFunc2:function(){

                // insert code
                var innerfunc2 = function(){
                }

        }

});

Reply via email to