Comments (7)
yes
from store.js.
Hi guys!
I think I would be a bit surprised if JSON parsing was a bottle neck in any real world usage of store.js. Do you do have such a problem? If you do I can definitely see the value of a store.exists(key)
. However, if you don't I believe it may be in the interest of the project to avoid adding features without real world needs. Basically in the interest of keeping it lean, avoiding feature creep, and so on.
What do you guys think?
Cheers,
Marcus
from store.js.
It's not a bottleneck in most cases, but when the data is large (few thousand items) it would be useful to avoid unneeded parsing.
from store.js.
Hmm, are you sure? Like, have you tested that? I would not take it for granted that the CPU bound parsing takes significantly longer than reading the string from disk (if that's how local storage persistence works, I don't know).
You may have a point, but if you haven't collected the data then can you know that there is a need
Cheers!
from store.js.
Here's an attempt at explaining why I'm hesitant adding things without understanding why it's necessary:
First the downsides: every new feature adds complexity, bytes to download (if store.js is used on thousands of sites and downloaded by millions of people every month, then do those bytes become meaningful? Probably. We recently removed support for Firefox 2 and 3 for this reason). It also is another thing to maintain, document, and read up on when you're considering to use the project and are trying to understand it.
However, there may be upsides! And if there are, I'm all for new beneficial features! But we should really know that they are beneficial!
Let me know if you are up to get some data supporting the need, would love to know the performance of read vs parse and if there is a significant bottleneck in either or if they're about the same. If not, I'm going to vote for closing this issue. Oui?
Cheers!
Marcus
from store.js.
👍
Hi!
I'm actually facing the same need! I use LocalStorage to store user requested information and I don't want to save a duplicated content. So if an option could exist, I also would be interested!
Based on the ReadMe example:
store.set('tags', ['javascript', 'localStorage', 'store.js'])
How can I check if user input (for example "store.js") exist in store.tags?
Cheers and thank you for your great plugin!
================================================
EDIT as closed topic:
Marcus, you've saved my day!
Thank you so much ;-)
Cheers!
from store.js.
Not quite the same issue, but here is what you'd do. Three options I guess:
Just store the tags:
store.set('javascript',true)
store.get('javascript)
Store all tags in an array:
var tags = store.get('tags') || []
var tagPresent = tags.indexOf('javascript') != -1
tags.push('javascript')
store.set('tags', tags)
Store tags in an object
var tags = store.get('tags') || {}
var tagPresent = tags['javascript']
tags['javascript'] = true
store.set('tags', tags)
Cheers!
Marcus
from store.js.
Related Issues (20)
- Chinese characters when encoding HOT 3
- Ignore me
- how do i read specifically items from session storage HOT 1
- Uncaught TypeError: t.charCodeAt is not a function HOT 2
- Error on Ubuntu: Cannot read property 'documentElement' of undefined HOT 1
- the json format data becomes a json string HOT 1
- how to use store.js with expire?
- Support Subdomains HOT 1
- Open facebook event in new window/tab HOT 1
- there is no Issues just question about security!!! HOT 7
- How to store a file? HOT 13
- clearAll() per namespace? HOT 4
- expire broken HOT 1
- Race conditions HOT 1
- Use Plugins with Typescript HOT 7
- Store instance
- store.js use in memory(localstorage) or physical disk( indexedDB)? what is size limit? HOT 1
- Expiry not set in cookieStorage.js HOT 2
- 存int数组,取值丢失精度 HOT 1
- global namespace
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from store.js.