localStorage attrib a function?
Closed this issue · 2 comments
snrbrnjna commented
Hi there,
just an idea: would it be possible to define the localstorage property on collections and models as a function?
i want to dynamically set the storage key, like that:
localStorage: function() {
return new Backbone.LocalStorage(this.storageKey);
}
Or do you have another way to achieve this?
Thanks for your great little lib!
jeromegn commented
We could use _.result(this, 'localStorage')
to get the value. Feel free to create a PR :)
snrbrnjna commented
OK. thanks. I solved it by initializing the LocalStorage in the constructor of the collection.