Skip to content

Using Bower to install Backbone Localstorage working properly #178

@seyade

Description

@seyade

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions