Closed phcoliveira closed 5 years ago
Hey @phcoliveira,
thanks for the feedback. I think what you want is already possible.
The storageFor
accepts a second argument that should be a dependent key.
So for your example that should work:
EmberObject.extend({
user: EmberObject.extend({
modelName: 'user',
id: '123'
}),
favorites: storageFor('favorites', 'user')`
// => 'storage:favorites:user:123'
})
The prefix is something I'll have to think about it.
Thanks, Manuel.
I have read the docs about that dependent key, but I thought it was about serializing the whole object to be used by Ember Data again.
Kind regards.
@phcoliveira if you have time to clarify the docs with an example that would be great.
Sure thing, I will do it in the next couple of days.
Hello there, great library by the way.
So I need to keep things in local storage individually; nothing sensitive, but they need to be personal. This is what I am using:
This works but it is not so great, as I have to use
notifyPropertyChange
after changingfavorites
.Using a prefix on config is useful for general purposes, but what happens if an addon wants to define its own prefix? Will it change the host app's prefix?
To me, the prefix is not actually a big deal because I namespace the storage with a folder
my-addon
.But what I really want is to have suffix. Given a storage named
favorites
, I would like to usestorageFor
as such:And I expect the storage to be defined as:
Thanks!