backbone.localStorage.js无法正常运行

时间:2014-12-23 21:50:52

标签: javascript backbone.js underscore.js

我正在尝试为我的Backbone.js应用程序设置本地存储仓库,但每当我在我的集​​合中包含localStorage:属性时,我就会继续“未定义不是函数”。我错过了什么?

我遵循这些指示:

https://github.com/jeromegn/Backbone.localStorage/blob/master/README.md

<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.7.0/underscore-min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/backbone.js/1.1.2/backbone-min.js"></script>
<script type='text/javascript' src="backbone.localStorage.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.1.15/require.min.js"></script>

    <script>

    (function($){

    //---------SINGLE ENTRY MODEL----------
            var Entry = Backbone.Model.extend({
                defaults: function(){
                    return{
                        word: '',
                        definition: ''
                    }
                }
            });

        //------------ENTRY MODEL COLLECTION------------
        EntryList = Backbone.Collection.extend({
                localStorage: new Backbone.localStorage('saved'),

                model: Entry
            });

        //-----INSTANCIATE COLLECTION----
        var dictionary = new EntryList();
        var saved = new EntryList();

        .
        .
        .

0 个答案:

没有答案