Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using Bower to install Backbone Localstorage working properly #178

Open
seyade opened this issue May 24, 2015 · 4 comments
Open

Using Bower to install Backbone Localstorage working properly #178

seyade opened this issue May 24, 2015 · 4 comments
Labels

Comments

@seyade
Copy link

seyade commented May 24, 2015

I used bower install backbone-localstorage for my project with this command bower install backbone-localstorage --save and for some reason when I use it as such:

define([
  'underscore',
  'backbone',
  'models/todo',
  'localstorage'
], function (_, Backbone, Todo) {
    'use strict';
    var TodosCollection = Backbone.Collection.extend({
        model: Todo,
        localStorage: new Backbone.LocalStorage('todos')
    });

    return TodosCollection;
});

I get Uncaught TypeError: object is not a function in the chrome browser.

After hours of head scratching, research and code tweaks, I decided to check the backbone.localstorage codebase and found out the code is very different from the original backbone.localstorage that's in this Github. For example no Backbone.Localstorage object is being returned at the end.

I think there's a mistake in the way bower is fetching the codebase. Or maybe I'm doing something wrong...

Or can someone tell me if there's a new way to use backbone.localstorage?

@ahwitz
Copy link

ahwitz commented Jul 1, 2015

For what it's worth, if anyone's having trouble using LocalStorage with ECMAScript 6/System.js/jspm, using jspm install github:jeromegn/Backbone.localStorage instead of jspm install npm:backbone-localstorage solved a related issue.

@kdoran
Copy link

kdoran commented Jan 3, 2016

@seyade it looks like it's because bower is installing an entirely differentl library for backbone localstorage: https://github.com/robmoorman/backbone-localstorage

@remmel
Copy link

remmel commented Jan 27, 2016

The library you want is here : https://github.com/jeromegn/Backbone.localStorage (different with https://github.com/robmoorman/backbone-localstorage)

add in bower.json dependencies : "backbone.localStorage": null
and run "bower update"

@AlahmadiQ8
Copy link

Had the same issue with jspm. @ahwitz 's suggestion solved it. Thank you!

@scott-w scott-w added the docs label Feb 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants