* Case 1

(function(window, $) {

var someVar = true;

var test = {

                some: 'test',

setValue: function() {

                    // some code

}

};

window.test = test;

})(window, jQuery);


* Case 2

var test = (function(test, $, undefined) {

    var someVar = true;

    test.some = 'test';

    test.setValue = function() {

        // some code

    }

    return test;

}(window.test || {}, jQuery));


Posted by linuxism
,