Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/glittershark/core-async-storage
Clojurescript wrapper around react-native's AsyncStorage using core.async
https://github.com/glittershark/core-async-storage
Last synced: 2 months ago
JSON representation
Clojurescript wrapper around react-native's AsyncStorage using core.async
- Host: GitHub
- URL: https://github.com/glittershark/core-async-storage
- Owner: glittershark
- License: mit
- Created: 2016-04-23T18:41:19.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-08-09T12:45:19.000Z (over 7 years ago)
- Last Synced: 2024-10-12T06:50:10.008Z (3 months ago)
- Language: Clojure
- Homepage:
- Size: 26.4 KB
- Stars: 39
- Watchers: 5
- Forks: 8
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Core.Async Storage [![Build Status](https://travis-ci.org/glittershark/core-async-storage.svg?branch=master)](https://travis-ci.org/glittershark/core-async-storage)
A Clojurescript wrapper around react-native's [AsyncStorage][] using
[core.async][][AsyncStorage]: https://facebook.github.io/react-native/docs/asyncstorage.html#content
[core.async]: https://github.com/clojure/core.async## Installation
[![Clojars Project](https://img.shields.io/clojars/v/core-async-storage.svg)](https://clojars.org/core-async-storage)
## Usage
In general, all exposed functions are `kebab-case` versions of AsyncStorage's
`camelCase` functions, that return a `core.async` channel instead of taking a
callback as their last argument, and also convert all input values to EDN and
read all return values as Clojure data structures```clojure
(ns my-ns.core
(:require [glittershark.core-async-storage :refer [get-item set-item]]
[cljs.core.async :refer [ [nil], or [error]
(println ( [nil {:bar "baz"}], or [error nil](let [a-map {:a "foo" :b "bar"}
a-vec [[:a "foo"][:b "bar"]]]
(go
;; multi-set can accept a map or a collection of vectors
(println ( [nil {:bar "baz"}]
(println ( [nil {:bar "baz"}]
```[promise-chan]: https://clojure.github.io/core.async/#clojure.core.async/promise-chan
## TODO
- [x] AsyncStorage.getItem
- [x] AsyncStorage.setItem
- [x] AsyncStorage.removeItem
- [ ] AsyncStorage.mergeItem
- [x] AsyncStorage.clear
- [ ] AsyncStorage.getAllKeys
- [ ] AsyncStorage.flushGetRequests
- [x] AsyncStorage.multiGet
- [x] AsyncStorage.multiSet
- [ ] AsyncStorage.multiRemove
- [ ] AsyncStorage.multiMerge## License
Copyright © 2017 Griffin Smith
Distributed under the MIT License.