@dafcoe/storage-monitor
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

@dafcoe/storage-monitor sample

npm bundle size npm GitHub package.json version

@dafcoe/storage-monitor

@dafcoe/storage-monitor is a simple monitor for local and session storage usage.
It adds a small widget to the bottom right corner of your page showing the overall usage of your local/session storage. When hovered, it expands up showing an item list sorted by size.
See it action on demo page.

Installation

Install the package as a project dependency using yarn or npm:

$ yarn add @dafcoe/storage-monitor
// or
$ npm install --save @dafcoe/storage-monitor

Usage

Import StorageMonitor class and create an object:

import StorageMonitor from '@dafcoe/storage-monitor';

new StorageMonitor();

Options

StorageMonitor class accepts the following arguments:

Storage Adapter

Stands for the type of storage to monitor. It can either be localStorage (default) or sessionStorage.

new StorageMonitor(localStorage);   // same as new StorageMonitor();
new StorageMonitor(sessionStorage);

Options

An object of options where you can customize the widget visibility and the reload rate.

new StorageMonitor(localStorage, {
  showWidget: true,
  autoReloadRateMs: 10000,  // in milisseconds | default: 1000 | minimum: 1000
});


  Please check the demo page to easily see it in action.

License

MIT License © Daf Coe

Package Sidebar

Install

npm i @dafcoe/storage-monitor

Weekly Downloads

1

Version

1.0.1

License

MIT

Unpacked Size

40.1 kB

Total Files

35

Last publish

Collaborators

  • dafcoe