Note that there are some explanatory texts on larger screens.

plurals
  1. PObackbone.localStorage, require.js, "Uncaught TypeError: undefined is not a function"
    primarykey
    data
    text
    <p>I'm following Uzi Kilon's BackboneJS / RequireJS / backbone.LocalStorage example at <a href="http://kilon.org/blog/2012/08/build-backbone-apps-using-requirejs/" rel="nofollow">http://kilon.org/blog/2012/08/build-backbone-apps-using-requirejs/</a>. </p> <p>When I <code>git clone https://github.com/uzikilon/Todos</code> it works just fine - but it uses older versions of backbone.localstorage. If I replace <code>lib/backbone.localStorage</code> with the newer version <code>http://cdnjs.cloudflare.com/ajax/libs/backbone-localstorage.js/1.1.0/backbone.localStorage-min</code>, though, then I get "Uncaught TypeError: undefined is not a function" here: <a href="https://github.com/uzikilon/Todos/blob/master/js/models/Todo.js#L3" rel="nofollow">https://github.com/uzikilon/Todos/blob/master/js/models/Todo.js#L3</a> - why? I think this has something to do with the tricky details at <a href="http://requirejs.org/docs/api.html#config-shim" rel="nofollow">http://requirejs.org/docs/api.html#config-shim</a> or perhaps this: <a href="http://blog.mostlystatic.com/2013/01/backbone-localstorage-uncaught.html" rel="nofollow">http://blog.mostlystatic.com/2013/01/backbone-localstorage-uncaught.html</a>.</p> <pre><code>require.config({ baseUrl: "./js/", paths: { jquery: 'lib/jquery-1.8.2', underscore: 'lib/underscore-1.4.2', backbone: 'lib/backbone-0.9.2', // 'backbone.localStorage': 'lib/backbone.localStorage' 'backbone.localStorage': 'http://cdnjs.cloudflare.com/ajax/libs/backbone-localstorage.js/1.1.0/backbone.localStorage-min' }, shim: { underscore: { exports: "_" }, backbone: { deps: ['underscore', 'jquery'], exports: 'Backbone' }, 'backbone.localStorage': { deps: ['backbone'], exports: 'Backbone' } } }); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload