Comments (4)
Isn't the defaultStorage set on init if passed in the options and then used by default?
https://github.com/Wisembly/basil.js/blob/master/src/basil.js#L189
from basil.js.
yes, but if you try to overwrite the default with example query, i don't think you will get the desired result.
var storages = _toStoragesArray(options.storages) || [this.defaultStorage];
set
does not use options.storage
, only options.storages
; and the way options.storages
are used seem undesirable.
from basil.js.
Indeed, we deprecated options.storage
and implemented instead options.storages
to allow storing on the go on one or more storages at the time.
If you want to persist on cookie
instead of default local
, just use
basil.set('foo', 'bar', { 'storages': ['cookie'] });
If you want to persist both in cookie and localstorage, use then
basil.set('foo', 'bar', { 'storages': ['local', 'cookie'] });
We changed a bit the API because we faced in our project the need to store something in localstorage which is fast for our app, but needed to persist it too in cookie for later usage.
I don't really see why the ability to set
and remove
on all available storage is an undesirable feature?
from basil.js.
Hi there,
We are nearly ready to roll out #26 0.4.0 version, that changed the actual behavior. Basil won't allow anymore to persist in simultaneous storages, but will choose the 1rst available storage in list if given in storages
options
// try first to store it into cookies and if not possible into localStorage
basil.set('foo', 'quux', { 'storages': ['cookie', 'local'] });
It would still be possible to directly store in a specific storage using Basil.localStorage.set()
API.
Best
from basil.js.
Related Issues (20)
- basil.localStorage.set does not stringify HOT 3
- Enable Sourcegraph HOT 2
- Please release 0.4.2 to npm HOT 4
- escaping keys caused namespaced cookie names to change HOT 5
- On change event for stored content HOT 2
- Safari private browsing, QUOTA_EXCEEDED_ERR: DOM Exception 22 HOT 18
- Publish 0.4.4 to npm? HOT 2
- Using with react HOT 3
- Doesn't work with Jest? HOT 1
- In Safari Privacy Browsing, basil.reset() is not clearing out things stored in cookie HOT 3
- Delimiter is not configurable HOT 5
- basil.reset() Doesn't clean cookies set with basel when invoked
- ipt 6 array flatten HOT 1
- expireDays only works for cookies
- base64 option HOT 1
- remove from cookies does not work for me HOT 3
- SameSite property on cookies not supported HOT 2
- Issue with namespace "reset" logic HOT 3
- cookie without secure attribute warning HOT 1
- handling path HOT 2
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 basil.js.