react-native-storage
Advanced tools
Comparing version 0.0.7 to 0.0.8
{ | ||
"name": "react-native-storage", | ||
"version": "0.0.7", | ||
"version": "0.0.8", | ||
"description": "This is a local storage wrapper for both react-native(AsyncStorage) and browser(localStorage). ES6/babel is needed.", | ||
@@ -5,0 +5,0 @@ "main": "storage.js", |
@@ -13,2 +13,7 @@ # react-native-storage | ||
## Usage 使用说明 | ||
### Config 配置 | ||
You need to use [babel](https://babeljs.io/) to enable es6 modules for web development(I'll provide an example in the next version). For React-Native development, put this [babel config file](https://github.com/brentvatne/react-native-animated-demo-tinder/blob/master/.babelrc) under your project directory. | ||
对于Web开发你需要使用[babel](https://babeljs.io/)来支持es6模块导入功能。(我会在下个版本中提供一个示例) 如果是React-Native开发,把这个[babel配置文件](https://github.com/brentvatne/react-native-animated-demo-tinder/blob/master/.babelrc)放到你的项目根目录中即可。 | ||
### Import 导入 | ||
@@ -15,0 +20,0 @@ var Storage = require('react-native-storage'); |
/* | ||
* local storage(web/react native) wrapper | ||
* sunnylqm 2015-08-24 | ||
* version 0.0.7 | ||
* sunnylqm 2015-09-01 | ||
* version 0.0.8 | ||
*/ | ||
@@ -151,3 +151,3 @@ let cache = {}; | ||
ret = JSON.parse(ret); | ||
if(ret && ret.expires < new Date().getTime()){ | ||
if(ret.expires < new Date().getTime()){ | ||
Storage.sync[id] && Storage.sync[id](); | ||
@@ -179,5 +179,12 @@ } | ||
ret = JSON.parse(ret); | ||
if(autoSync && ret && ret.expires < new Date().getTime() | ||
&& kv.length > 1 && Storage.sync[kv[0]]){ | ||
Storage.sync[kv[0]](kv[1]); | ||
if(ret.expires < new Date().getTime()){ | ||
if(autoSync && kv.length > 1 && Storage.sync[kv[0]]) { | ||
Storage.sync[kv[0]](kv[1]); | ||
} | ||
else{ | ||
resolve({ | ||
syncId: kv[1] | ||
}); | ||
return; | ||
} | ||
} | ||
@@ -184,0 +191,0 @@ resolve(ret.rawData); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15783
293
99