开发者

Not sure about this style of jQuery/Javascript proramming.

Im wanting to do a tutorial for my blog/portfolio site and I realized that... For all I know about this particular method of jQuery/Javascript programming, I do not know what to call it or what other p开发者_如何学Pythoneople call it. I know its a particular method of OOP and the person who showed me how to do this referred to it as "Prototyping". But when searching for it on google, im not finding anything similar. Here is condensed example:

jQuery().ready(function() {
site.internal.page = function () {
    return {                        
        init: function () {

            var that = this;                            

        },
        business: function () {
            return {
                init: function () {

                },
                doSomething: function () {                                                  

                },  
                        addSomething: function (r) {

                },
                makeSomethign: function () {

                }                                   
            }
        }(),
        invoice: function () {
            return {
                init: function () {         
                    that = this;                

                },
                addItem: function (row) {


                }
            }
        }()
    }
}();

site.internal.page.init();
});

Can anyone assist me in figuring out what to refer to this as. Im not sure if its the same as making a library or a plug-in, but id really like to figure it out. Thanks.


You are creating anonymous functions and storing a reference to each in a variable.


If refereing to the site.internal.page part, I would suggest this is an attempt to namespace the javascript in a large site.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜