backbone 更新1.1.2

backbone已经更新到1.1.2,在这里总结一下

我还一直用的1.0的版本,更新确实出现了一些问题

1.1.0  Backbone Views no longer automatically attach options passed to the constructor as this.options (backbone不再将options传给构造器函数作为this.options)

  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 恢复原来功能

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 原来*/
   })

    )
原文地址:https://www.cnblogs.com/breakdown/p/3665829.html