2

jQuery アプリケーション アーキテクチャのベスト プラクティスを探しています。

このサンプルは機能していますが、これは最善の方法ではないと思います。

サンプルとして、カーネル関数 (config の読み込み、init サブモジュールなど) とタブの dub-module があります。

"use strict";
(function($, app, window) {

    app.kernel = function() {
        var self = this;
        app.tabs().init(); // init tabs sub-module
        return self;
    };

    app.tabs = function() {
        var self = this;
        self.init = function() {
            console.log('tabs function init');
        };
        return self;

    };

})(jQuery, window.SuperPuper || (window.SuperPuper = {}), window);

$(function() {
    new SuperPuper.kernel();
});

以下の資料を作成しました:

  1. 継承パターンを使用して大規模な jQuery アプリケーションを編成する
  2. 保守可能な jQuery アプリケーションの書き方
4

1 に答える 1

0

jQueryパターンの最良のリソースは、この主題に関する他のすべての資料をわかりやすい形式にまとめたAddyOsmaniによるものです。

http://addyosmani.com/blog/essential-jquery-plugin-patterns/

于 2013-01-19T11:05:10.460 に答える