|
2 年之前 | |
---|---|---|
.. | ||
dist | 2 年之前 | |
examples | 2 年之前 | |
lib | 2 年之前 | |
test | 2 年之前 | |
typing-tests | 2 年之前 | |
typings | 2 年之前 | |
.babelrc | 2 年之前 | |
.eslintrc | 2 年之前 | |
.jscsrc | 2 年之前 | |
.jshintrc | 2 年之前 | |
.travis.yml | 2 年之前 | |
LICENSE | 2 年之前 | |
README.md | 2 年之前 | |
bower.json | 2 年之前 | |
package.json | 2 年之前 | |
rollup.config.es6.js | 2 年之前 | |
rollup.config.js | 2 年之前 | |
rollup.config.test.js | 2 年之前 | |
rollup.config.umd.js | 2 年之前 |
Adds getItems method to localForage.
npm i localforage-getitems
Just like getItem()
but you can pass an array with the keys that need to be retrieved.
var keys = ['asdf','asap','async'];
localforage.getItems(keys).then(function(results) {
console.log(results);
// prints:
// {
// asdf: 'asdf value!',
// asap: 'asap value!',
// async: 'async value!'
// }
console.log(results.asdf);
console.log(results['asdf']);
console.log(results[keys[0]]);
// all the above print 'asdf value!'
});
Invoking getItems()
without arguments (or with null
as the first argument) will retrieve all the items of the current driver instance.
localforage.getItems().then(function(results) { });
// or by using callbacks
localforage.getItems(null, function(results) { });