backbone 更新1.1.2

backbone已經更新到1.1.2,在這裏總結一下javascript

我還一直用的1.0的版本,更新確實出現了一些問題java

1.1.0  Backbone Views no longer automatically attach options passed to the constructor as this.options (backbone再也不將options傳給構造器函數做爲this.options)
jquery

  var View = Backbone.View = function(options) {
        this.cid = _.uniqueId('view');
        options || (options = {});
        _.extend(this, _.pick(options, viewOptions));
        this._ensureElement();
        this.initialize.apply(this, arguments);
        this.delegateEvents();
    };

不知道爲何要這麼作   this.options = options 恢復原來功能app

1.1.1  Backbone now registers itself for AMD (Require.js)   支持AMD封裝了,函數

(function (root, factory) {

    // Set up Backbone appropriately for the environment. Start with AMD.
    if (typeof define === 'function' && define.amd) {
        define(['underscore', 'jquery', 'exports'], function (_, $, exports) {
            // Export global even in AMD case in case this script is loaded with
            // others that may still expect a global Backbone.
            root.Backbone = factory(root, exports, _, $);
        });

        // Next for Node.js or CommonJS. jQuery may not be needed as a module.
    } else if (typeof exports !== 'undefined') {
        var _ = require('underscore');
        factory(root, exports, _);
        // Finally, as a browser global.
    } else {
        root.Backbone = factory(root, {}, root._, (root.jQuery || root.Zepto || root.ender || root.$));
    }

}(this, function (root, Backbone, _, $) {
    /*backbone 原來*/
   })

    )
相關文章
相關標籤/搜索