JSPM

persist-storage

1.0.3
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • 0
  • Score
    100M100P100Q41676F
  • License Apache-2.0

Enable persistant storage in the browser

Package Exports

  • persist-storage

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (persist-storage) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

persist-storage

npm version build status downloads js-standard-style

Enable persistent storage in the browser.

By default storage such as indexedDB can be cleared when a device starts running out of space. This module is a thin wrapper around the StorageManager API, checking if persistent storage is enabled — and enabling it if it isn't enabled yet, and able to enable it.

Usage

var persist = require('persist-storage')

persist(function (success) {
  if (success) {
    console.log('Storage will not be cleared except by explicit user action')
  } else {
    console.log('Storage may be cleared by the UA under storage pressure.')
  }
})

API

persist(callback(ok))

Enable persistent storage. Calls a callback with a boolean that's true for success and false for failure to enable it.

License

Apache-2.0