localForage/localForage
在 GitHub 查看Make "name" optional in config when driver = localstorage
Open
#641 创建于 2017年1月6日
bugdocshelp wantedquestion
描述
I am trying to read key "counter" from localstorage, but can't, because it tries to read "/counter" if I set name to "". If I set name to "whatever" it reads "whatever/counter".
Can you change line 20 in localForage/src/drivers/localstorage.js from
dbInfo.keyPrefix = dbInfo.name + '/';
to something like
dbInfo.keyPrefix = (dbInfo.name && dbInfo.name != "") ? dbInfo.name + '/' : '';