{"action":"created","issue":{"url":"https://api.github.com/repos/funkensturm/ember-local-storage/issues/120","repository_url":"https://api.github.com/repos/funkensturm/ember-local-storage","labels_url":"https://api.github.com/repos/funkensturm/ember-local-storage/issues/120/labels{/name}","comments_url":"https://api.github.com/repos/funkensturm/ember-local-storage/issues/120/comments","events_url":"https://api.github.com/repos/funkensturm/ember-local-storage/issues/120/events","html_url":"https://github.com/funkensturm/ember-local-storage/issues/120","id":151705638,"number":120,"title":"sessionStorage adapter/serializer?","user":{"login":"schickm","id":197222,"avatar_url":"https://avatars.githubusercontent.com/u/197222?v=3","gravatar_id":"","url":"https://api.github.com/users/schickm","html_url":"https://github.com/schickm","followers_url":"https://api.github.com/users/schickm/followers","following_url":"https://api.github.com/users/schickm/following{/other_user}","gists_url":"https://api.github.com/users/schickm/gists{/gist_id}","starred_url":"https://api.github.com/users/schickm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/schickm/subscriptions","organizations_url":"https://api.github.com/users/schickm/orgs","repos_url":"https://api.github.com/users/schickm/repos","events_url":"https://api.github.com/users/schickm/events{/privacy}","received_events_url":"https://api.github.com/users/schickm/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-04-28T18:00:10Z","updated_at":"2016-05-10T17:10:32Z","closed_at":null,"body":"Thanks for the awesome library!\r\n\r\nI found myself wanting to use sessionStorage for ember models rather then localStorage.  I'm wondering what you'd think about supporting an adapter/serializer for sessionStorage in the library?  Or, just making the existing adapter a little more flexible for accommodating the change to sessionStorage.  \r\n\r\nBelow is what I had to do to make my own extension of the existing adapter (the serializer required no changes).  As you can see I'm overriding some internal properties of the class, which makes me a little leery as the library internals could change at any time.\r\n\r\nI'm happy to provide a pull request for either if you're interested.\r\n\r\n ```javascript\r\nimport Ember from 'ember';\r\nconst {\r\n  get,\r\n} = Ember;\r\n\r\nimport LocalStorageAdapter from 'ember-local-storage/adapters/adapter';\r\nimport { getStorage } from 'ember-local-storage/helpers/storage';\r\nimport StorageArray from 'ember-local-storage/session/array';\r\n\r\nexport default LocalStorageAdapter.extend({\r\n    _storage: getStorage('session'),\r\n\r\n    _getIndex(type) {\r\n        const indices = get(this, '_indices');\r\n\r\n        if (!indices[type]) {\r\n            indices[type] = StorageArray\r\n            .extend({ _storageKey: 'index-' + type })\r\n            .create();\r\n        }\r\n\r\n        return indices[type];\r\n    },\r\n});\r\n```"},"comment":{"url":"https://api.github.com/repos/funkensturm/ember-local-storage/issues/comments/218225559","html_url":"https://github.com/funkensturm/ember-local-storage/issues/120#issuecomment-218225559","issue_url":"https://api.github.com/repos/funkensturm/ember-local-storage/issues/120","id":218225559,"user":{"login":"schickm","id":197222,"avatar_url":"https://avatars.githubusercontent.com/u/197222?v=3","gravatar_id":"","url":"https://api.github.com/users/schickm","html_url":"https://github.com/schickm","followers_url":"https://api.github.com/users/schickm/followers","following_url":"https://api.github.com/users/schickm/following{/other_user}","gists_url":"https://api.github.com/users/schickm/gists{/gist_id}","starred_url":"https://api.github.com/users/schickm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/schickm/subscriptions","organizations_url":"https://api.github.com/users/schickm/orgs","repos_url":"https://api.github.com/users/schickm/repos","events_url":"https://api.github.com/users/schickm/events{/privacy}","received_events_url":"https://api.github.com/users/schickm/received_events","type":"User","site_admin":false},"created_at":"2016-05-10T17:10:32Z","updated_at":"2016-05-10T17:10:32Z","body":"No problem, we're all busy people.  \r\n\r\nFor an application I'm working on, we have some data that we want to disappear when the user closes their browser window, and some data that we want to stick around.  So we use a mix of local and session storage.\r\n\r\nSo do you want the PR to just have a separate adapter like the one above?  Then just add a little note in the documentation about the special case?  I worry that it might be a little confusing for first time users that the adapter for localStorage is `ember-local-storage/adapters/adapter`, but the adapter for sessionStorage would be something like `ember-local-storage/adapters/session-storage-adapter.\r\n\r\nI propose that we move the code from `ember-local-storage/adapters/adapter` to `ember-local-storage/adapters/local-storage-adapter`.  Then have `ember-local-storage/adapters/adapter` just export the new `local-storage-adapter`  along with displaying a deprecation notice for the next couple releases.  Then put the sessionStorage adapter at `ember-local-storage/adapters/session-storage-adapter`.\r\n\r\nI assume issuing deprecation notices from ember addons is a thing?  It's not just something internal to ember?\r\n\r\nSound good?"}}