idbc
TypeScript icon, indicating that this package has built-in type declarations

0.0.3 • Public • Published

idbc

An Class of IndexedDB wrapper

Basic Usage

import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
import { Idb } from 'idbc';

const DB_NAME = 'IDBDemo';
const DB_STORE_NAME = 'IDBDemoStore';

interface IInfoItem {
  recordId: number;
  value?: string;
}

const IDBDemo = new Idb<{ [DB_STORE_NAME]: IInfoItem }>(DB_NAME, 1, [
  { storeName: DB_STORE_NAME, keyPath: 'recordId' },
]);

IDBDemo.add(DB_STORE_NAME, { recordId: Date.now(), value: 'value' });

Package Sidebar

Install

npm i idbc

Weekly Downloads

3

Version

0.0.3

License

none

Unpacked Size

26.7 kB

Total Files

27

Last publish

Collaborators

  • changlin