@notesnook/localforage-getitems
TypeScript icon, indicating that this package has built-in type declarations

1.4.4 • Public • Published

localForage-getItems

npm
Adds getItems method to localForage.

Requirements

  • localForage v1.4.0+
    • for earlier versions of localforage, please use the v1.1.x releases

Installation

npm i localforage-getitems

jsperf links

API

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) { });

/@notesnook/localforage-getitems/

    Package Sidebar

    Install

    npm i @notesnook/localforage-getitems

    Weekly Downloads

    4

    Version

    1.4.4

    License

    none

    Unpacked Size

    44.3 kB

    Total Files

    31

    Last publish

    Collaborators

    • thecodrr