@react-native-community/async-storage
Advanced tools
Comparing version 2.0.0-rc.1 to 2.0.0-rc.2
@@ -18,5 +18,7 @@ "use strict"; | ||
*/ | ||
const isDevelopment = // @ts-ignore | ||
process && process.env && process.env.NODE_ENV === 'development' || __DEV__; | ||
const factoryOptions = { | ||
logger: __DEV__, | ||
errorHandler: __DEV__ | ||
logger: isDevelopment, | ||
errorHandler: isDevelopment | ||
}; | ||
@@ -99,2 +101,2 @@ exports.factoryOptions = factoryOptions; | ||
} | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9kZWZhdWx0cy50cyJdLCJuYW1lcyI6WyJmYWN0b3J5T3B0aW9ucyIsImxvZ2dlciIsIl9fREVWX18iLCJlcnJvckhhbmRsZXIiLCJzaW1wbGVFcnJvckhhbmRsZXIiLCJlIiwiZXJyb3JNZXNzYWdlIiwiRXJyb3IiLCJtZXNzYWdlIiwiY29uc29sZSIsImVycm9yIiwic2ltcGxlTG9nZ2VyIiwibG9nSW5mbyIsImxvZyIsImFjdGlvbiIsImtleSIsInZhbHVlIiwibm9vcCJdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7OztBQUFBOzs7Ozs7O0FBVU8sTUFBTUEsY0FBOEIsR0FBRztBQUM1Q0MsRUFBQUEsTUFBTSxFQUFFQyxPQURvQztBQUU1Q0MsRUFBQUEsWUFBWSxFQUFFRDtBQUY4QixDQUF2Qzs7O0FBS0EsU0FBU0Usa0JBQVQsQ0FBNEJDLENBQTVCLEVBQStDO0FBQ3BELE1BQUlDLFlBQVksR0FBR0QsQ0FBQyxZQUFZRSxLQUFiLEdBQXFCRixDQUFDLENBQUNHLE9BQXZCLEdBQWlDSCxDQUFwRDtBQUNBSSxFQUFBQSxPQUFPLENBQUNDLEtBQVIsQ0FBY0osWUFBZDtBQUNEOztBQUVNLFNBQVNLLFlBQVQsQ0FBc0JDLE9BQXRCLEVBQTZDO0FBQ2xELFFBQU1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sZSB2YWx1ZXMgZm9yIGtleXM6ICR7a2V5fWApO1xuICAgICAgYnJlYWs7XG4gICAgfVxuICAgIGNhc2UgJ2Ryb3AnOiB7XG4gICAgICBsb2coJ0Ryb3BwaW5nIHdob2xlIGRhdGFiYXNlJyk7XG4gICAgICBicmVhaztcbiAgICB9XG4gICAgY2FzZSAna2V5cyc6IHtcbiAgICAgIGxvZygnUmV0cmlldmluZyBrZXlzJyk7XG4gICAgICBicmVhaztcbiAgICB9XG4gICAgZGVmYXVsdDoge1xuICAgICAgbG9nKGBVbmtub3duIGFjdGlvbjogJHthY3Rpb259YCk7XG4gICAgfVxuICB9XG59XG5cbmV4cG9ydCBmdW5jdGlvbiBub29wKCkge1xuICAvLyBub29wXG59XG4iXX0= |
@@ -23,7 +23,7 @@ "use strict"; | ||
constructor() { | ||
throw new Error("[AsyncStorage] AsyncStorageFactory must not be instantiated.\nInstead, use static functions, like 'create' to get AsyncStorage instance."); | ||
throw new Error("[AsyncStorage] AsyncStorageFactory must not be instantiated.\nInstead, use its 'create' method to create AsyncStorage instance."); | ||
} | ||
static create(storage, opts = _defaults.factoryOptions) { | ||
return new _AsyncStorage.default(storage, opts); | ||
static create(storage, opts = null) { | ||
return new _AsyncStorage.default(storage, opts || _defaults.factoryOptions); | ||
} | ||
@@ -35,2 +35,2 @@ | ||
exports.default = _default; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9pbmRleC50cyJdLCJuYW1lcyI6WyJBc3luY1N0b3JhZ2VGYWN0b3J5IiwiY29uc3RydWN0b3IiLCJFcnJvciIsImNyZWF0ZSIsInN0b3JhZ2UiLCJvcHRzIiwiZmFjdG9yeU9wdGlvbnMiLCJBc3luY1N0b3JhZ2UiXSwibWFwcGluZ3MiOiI7Ozs7Ozs7QUFRQTs7QUFDQTs7OztBQVRBOzs7Ozs7O0FBWUEsTUFBTUEsbUJBQU4sQ0FBMEI7QUFDe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RmFjdG9yeTtcbiJdfQ== |
# Async Storage usage | ||
Async Storage is a collection of usable storage backends for your App. | ||
Async Storage is a collection of persistent storage for different platforms, with unified API. | ||
It comes in two parts: core and storage backend, you want to use. | ||
It comes in two parts: the core and storage itself. | ||
*Core* is a consumer of the storage, provides you a unified API to save and read data. | ||
*Core* - a consumer for the storage, provides a unified API to use it. | ||
*Storage backend* implements an interface that *core* API understands and uses. Its functionality depends on storage itself. | ||
*Storage backend* - platform-dependant implementation of persistent data storage. | ||
@@ -14,9 +14,13 @@ | ||
In this example, we'll be using [Legacy storage](https://github.com/react-native-community/async-storage/tree/master/packages/storage-legacy). | ||
In this example, [Legacy storage](https://github.com/react-native-community/async-storage/tree/master/packages/storage-legacy) is used. | ||
```bash | ||
# Install core | ||
$ yarn add @react-native-community/async-storage@next | ||
``` | ||
```bash | ||
# Install legacy backend storage | ||
$ yarn add @react-native-community/async-storage-backend-legacy@next | ||
@@ -39,2 +43,3 @@ ``` | ||
name: string | ||
age: number | ||
} | ||
@@ -60,3 +65,4 @@ } | ||
const myUser = { | ||
name: 'test' | ||
name: 'John', | ||
age: 22 | ||
}; | ||
@@ -63,0 +69,0 @@ |
# Authoring Storage Backend | ||
Async Storage is a [facade](https://en.wikipedia.org/wiki/Facade_pattern) over the underlying Storage solution. | ||
Async Storage is a [facade](https://en.wikipedia.org/wiki/Facade_pattern) over the underlying Storage solution. | ||
In order for the new storage to be compatible, it has to implement `IStorageBackend` and its methods. | ||
@@ -25,4 +25,4 @@ | ||
- `setMany` - provided an array of `key-value` pairs, saves them to the storage | ||
- `removeMany` - removes a bunch of values, for a provided array of `keys` | ||
- `getKeys` - returns an array of `keys` that were used to store values | ||
- `removeMany` - removes a bunch of values, for a provided array of `keys` | ||
- `getKeys` - returns an array of `keys` that were used to store values | ||
- `dropStorage` - purges the storage | ||
@@ -38,3 +38,3 @@ | ||
## Going being default API | ||
## Going beyond the default API | ||
@@ -91,3 +91,3 @@ Unified API can be limiting - storages differ from each other and contain features that others do not. Async Storage comes with an extension property, that lets you extend its standard API. | ||
Let's create a storage backend for web, using `LocalStorage` API. | ||
Let's create a storage backend for web, using `LocalStorage` API. | ||
@@ -98,3 +98,3 @@ Start by adding `AsyncStorage` to your dependencies. | ||
$ yarn add @react-native-community/async-storage | ||
``` | ||
``` | ||
@@ -101,0 +101,0 @@ Then, create a class and implement `IStorageBackend` interface; |
{ | ||
"name": "@react-native-community/async-storage", | ||
"version": "2.0.0-rc.1", | ||
"version": "2.0.0-rc.2", | ||
"main": "build/index.js", | ||
@@ -19,3 +19,3 @@ "types": "types/index.d.ts", | ||
}, | ||
"gitHead": "a8e83d1be5dfcf24d0d6547badb24f53cf2756f5" | ||
"gitHead": "91681d5d86c87a1548a7239ec064974df28d3262" | ||
} |
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
43895
380