Cannot use Backbone.localStorage

902 views Asked by At

I'm getting this error with FF: TypeError: Backbone.localStorage is not a constructor

This is the code:

app.MyCollection= Backbone.Collection.extend({
  model: app.TestModel,
  localStorage: new Backbone.localStorage("test-backbone")
});

Anyone has an idea why this doesn't work? Not even to add the storage?

2

There are 2 answers

0
Phil On BEST ANSWER

Damn! It was just a stupid typo.

The line should be: localStorage: new Backbone.LocalStorage("test-backbone") with an uppercase "L".

Not it works.

0
Elise Chant On

Check that you're using the right syntax for the plugin because there are several Backbone Localstorage plugins with various initialisation methods.