Skip to content

dafcoe/storage-monitor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@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