question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

localStorage vs sessionStorage

See original GitHub issue

I think it might be good to provide an option to set the storage type (or switch between the two)

  1. localStorage is persistent and per domain
  2. sessionStorage is non-persistent and per tab/page

Both have their own applications.

Suggested API change:

// type -- str, either "localStorage" or sessionStorage"
store.use(type)

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
marcuswestincommented, Dec 20, 2016

store.js v2 is almost complete, and has a session storage option (among a bunch of additional addon features - see https://github.com/marcuswestin/store.js/tree/v2-dev/storage & https://github.com/marcuswestin/store.js/tree/v2-dev/addon)

1reaction
marcuswestincommented, Feb 28, 2017

The docs explain how to create a custom build - to get one that only uses sessionStorage, you can do this:

// Example custom build usage:
var engine = require('../store-engine')
var storages = [require('store/storages/sessionStorage')
var plugins = []
var store = engine.createStore(storages, plugins)
store.set('foo', 'bar')
Read more comments on GitHub >

github_iconTop Results From Across the Web

Introduction to localStorage and sessionStorage
localStorage and sessionStorage are almost identical and have the same API. The difference is that with sessionStorage , the data is persisted ...
Read more >
HTML5 Local storage vs. Session storage - javascript
The main difference between localStorage and sessionStorage is that sessionStorage is unique per tab. If ...
Read more >
Difference Between Local Storage, Session Storage And ...
Session Storage objects can be accessed using the sessionStorage read-only property. The difference between sessionStorage and localStorage ...
Read more >
Local Storage vs Session Storage vs Cookie
Both storage provide a large memory capacity. To be more specific, local Storage stores up to 10 megabytes and session storage stores up...
Read more >
Session Storage vs. Local Storage: What Are the ...
Remember that while local storage stores data across several tabs, session storage is unique to each tab, for the most part. You should...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found