sunnylqm / react-native-storage

local storage wrapper for both react-native and browser. Support size controlling, auto expiring, remote data auto syncing and getting batch data in one query.
MIT License
3.02k stars 268 forks source link

为什么key值不能使用包含_的特殊符号来命名,设计上有什么作用吗? #201

Closed crixusshen closed 5 years ago

crixusshen commented 5 years ago

为了兼容web端已经实现好的功能,当时数据状态的命名规范都是根据来命名的,为了让RN能够复用这些localstorage内的状态,所以命名上必须保持一致,因为RN和WEB的代码都是同一份,但是源代码中很明确的会检查是否key值包含,如果有则直接console.error。我想了解下为什么需要过滤掉这个特殊字符,是存在什么坑吗?

sunnylqm commented 5 years ago

因为key值的分割是用了_符号 但是你数据状态用什么都无所谓啊