summaryrefslogtreecommitdiff
path: root/www/lib/localforage/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'www/lib/localforage/README.md')
-rw-r--r--www/lib/localforage/README.md89
1 files changed, 42 insertions, 47 deletions
diff --git a/www/lib/localforage/README.md b/www/lib/localforage/README.md
index e51d3bb6..63fdfd55 100644
--- a/www/lib/localforage/README.md
+++ b/www/lib/localforage/README.md
@@ -1,4 +1,8 @@
-# localForage [![Build Status](https://travis-ci.org/mozilla/localForage.svg?branch=master)](http://travis-ci.org/mozilla/localForage)
+# localForage
+[![Build Status](https://travis-ci.org/localForage/localForage.svg?branch=master)](http://travis-ci.org/localForage/localForage)
+[![NPM version](https://badge.fury.io/js/localforage.svg)](http://badge.fury.io/js/localforage)
+[![Dependency Status](https://img.shields.io/david/localForage/localForage.svg)](https://david-dm.org/localForage/localForage)
+[![npm](https://img.shields.io/npm/dm/localforage.svg?maxAge=2592000)]()
localForage is a fast and simple storage library for JavaScript. localForage
improves the offline experience of your web app by using asynchronous storage
@@ -14,7 +18,7 @@ To use localForage, just drop a single JavaScript file into your page:
<script>localforage.getItem('something', myCallback);</script>
```
-Download the [latest localForage from GitHub](https://github.com/mozilla/localForage/releases/latest), or install with
+Download the [latest localForage from GitHub](https://github.com/localForage/localForage/releases/latest), or install with
[npm](https://www.npmjs.com/):
```bash
@@ -29,12 +33,12 @@ bower install localforage
localForage is compatible with [browserify](http://browserify.org/).
-[supported browsers]: https://github.com/mozilla/localForage/wiki/Supported-Browsers-Platforms
+[supported browsers]: https://github.com/localForage/localForage/wiki/Supported-Browsers-Platforms
## Support
Lost? Need help? Try the
-[localForage API documentation](https://mozilla.github.io/localForage).
+[localForage API documentation](https://localforage.github.io/localForage).
If you're stuck using the library, running the tests, or want to contribute
to localForage, you can visit
@@ -46,6 +50,10 @@ is usually online from 8am-8pm GMT (London Time).
[tofumatt]: http://tofumatt.com/
+## Safari 10.1+
+
+Since Safari 10.1 we default to IndexedDB; see the [CHANGELOG](https://github.com/localForage/localForage/blob/master/CHANGELOG.md) for more info.
+
# How to use localForage
## Callbacks vs Promises
@@ -54,8 +62,8 @@ Because localForage uses async storage, it has an async API.
It's otherwise exactly the same as the
[localStorage API](https://hacks.mozilla.org/2009/06/localstorage/).
-localForage has a dual API that allows you to either use Node-style callbacks
-or [Promises](https://www.promisejs.org/). If you are unsure which one is right for you, it's recommend to use Promises.
+localForage has a dual API that allows you to either use Node-style callbacks
+or [Promises](https://www.promisejs.org/). If you are unsure which one is right for you, it's recommended to use Promises.
Here's an example of the Node-style callback form:
@@ -63,7 +71,7 @@ Here's an example of the Node-style callback form:
localforage.setItem('key', 'value', function (err) {
// if err is non-null, we got an error
localforage.getItem('key', function (err, value) {
- // if err is non-null, we got an error. otherwise, value is the value
+ // if err is non-null, we got an error. otherwise, value is the value
});
});
```
@@ -80,7 +88,7 @@ localforage.setItem('key', 'value').then(function () {
});
```
-For more examples, please visit [the API docs](http://mozilla.github.io/localForage).
+For more examples, please visit [the API docs](https://localforage.github.io/localForage).
## Storing Blobs, TypedArrays, and other JS objects
@@ -96,7 +104,7 @@ JSON, as well as ArrayBuffers, Blobs, and TypedArrays. Check the
All types are supported in every storage backend, though storage limits in
localStorage make storing many large Blobs impossible.
-[api]: https://mozilla.github.io/localForage/#setitem
+[api]: https://localforage.github.io/localForage/#setitem
## Configuration
@@ -160,22 +168,30 @@ localForage 1.3+ works with both Browserify and Webpack. If you're using an
earlier version of localForage and are having issues with Browserify or
Webpack, please upgrade to 1.3.0 or above.
-If you're using localForage in your own build system (eg. browserify or
-webpack) make sure you have the
-[required plugins and transformers](https://github.com/mozilla/localForage/blob/master/package.json#L24)
-installed (eg. `npm install --save-dev babel-plugin-system-import-transformer`).
+Webpack will emit a warning about using a prebuilt javascript file which is fine. If you want to remove the warning you should exclude `localforage` from being parsed by webpack using the following conf :
+
+```javascript
+module: {
+ noParse: /node_modules\/localforage\/dist\/localforage.js/,
+ loaders: [...],
+```
## TypeScript
-To import localForage in TypeScript:
+If you have the [`allowSyntheticDefaultImports` compiler option](https://www.typescriptlang.org/docs/handbook/compiler-options.html) set to `true` in your [tsconfig.json](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html) (supported in TypeScript v1.8+), you should use:
```javascript
-const localForage:LocalForage = require("localforage");
+import localForage from "localforage";
```
-Note that the ES6 style import is not supported for our module type. Check out the following to know why:
-* http://stackoverflow.com/questions/29596714/new-es6-syntax-for-importing-commonjs-amd-modules-i-e-import-foo-require
-* http://www.jbrantly.com/es6-modules-with-typescript-and-webpack/
+Otherwise you should use one of the following:
+
+```javascript
+import * as localForage from "localforage";
+// or, in case that the typescript version that you are using
+// doesn't support ES6 style imports for UMD modules like localForage
+import localForage = require("localforage");
+```
## Framework Support
@@ -184,21 +200,21 @@ models in your framework so you can store data offline with localForage. We
have drivers for the following frameworks:
* [AngularJS](https://github.com/ocombe/angular-localForage)
-* [Backbone](https://github.com/mozilla/localForage-backbone)
+* [Backbone](https://github.com/localForage/localForage-backbone)
* [Ember](https://github.com/genkgo/ember-localforage-adapter)
If you have a driver you'd like listed, please
-[open an issue](https://github.com/mozilla/localForage/issues/new) to have it
+[open an issue](https://github.com/localForage/localForage/issues/new) to have it
added to this list.
## Custom Drivers
You can create your own driver if you want; see the
-[`defineDriver`](https://mozilla.github.io/localForage/#definedriver) API docs.
+[`defineDriver`](https://localforage.github.io/localForage/#definedriver) API docs.
There is a [list of custom drivers on the wiki][custom drivers].
-[custom drivers]: https://github.com/mozilla/localForage/wiki/Custom-Drivers
+[custom drivers]: https://github.com/localForage/localForage/wiki/Custom-Drivers
# Working on localForage
@@ -206,7 +222,7 @@ You'll need [node/npm](http://nodejs.org/) and
[bower](http://bower.io/#installing-bower).
To work on localForage, you should start by
-[forking it](https://github.com/mozilla/localForage/fork) and installing its
+[forking it](https://github.com/localForage/localForage/fork) and installing its
dependencies. Replace `USERNAME` with your GitHub username and run the
following:
@@ -236,33 +252,12 @@ a browser environment. Local tests are run on a headless WebKit (using
When you submit a pull request, tests will be run against all browsers that
localForage supports on Travis CI using [Sauce Labs](https://saucelabs.com/).
-## Building the API Documentation
-
-We currently use a Ruby tool to build our
-[API documentation](https://mozilla.github.io/localForage). You can install the Ruby dependencies with [Bundler](http://bundler.io):
-
-```bash
-# From inside the localForage directory
-bundle install
-```
-
-Then use `grunt` to serve the site:
-
-```bash
-grunt site
-```
-
-Navigate to [localhost:4567](http://localhost:4567/) in your browser to see the
-docs.
-
-There is an [open issue to move to a node tool for the docs](https://github.com/mozilla/localForage/issues/192).
-
# License
This program is free software; it is distributed under an
-[Apache License](https://github.com/mozilla/localForage/blob/master/LICENSE).
+[Apache License](https://github.com/localForage/localForage/blob/master/LICENSE).
---
-Copyright (c) 2013-2015 [Mozilla](https://mozilla.org)
-([Contributors](https://github.com/mozilla/localForage/graphs/contributors)).
+Copyright (c) 2013-2016 [Mozilla](https://mozilla.org)
+([Contributors](https://github.com/localForage/localForage/graphs/contributors)).