How to use the @cliqz-oss/dexie function in @cliqz-oss/dexie

To help you get started, we’ve selected a few @cliqz-oss/dexie examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cliqz-oss / browser-core / platforms / webextension / kv-store.es View on Github external
*
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
 */

/* eslint import/no-mutable-exports: 'off' */

import Dexie from '@cliqz-oss/dexie';
import { chrome } from './globals';
import console from '../core/console';

let storage = {};

try {
  const db = new Dexie('cliqz-kv-store');
  db.version(1).stores({ kv: 'key' });
  storage = {
    get(key) {
      return db.kv.get(key).then(result => result.value);
    },

    set(key, value) {
      return db.kv.put({ key, value });
    },

    remove(key) {
      return db.kv.delete(key);
    }
  };
} catch (e) {
  // unalble to load indexeddb

@cliqz-oss/dexie

A Minimalistic Wrapper for IndexedDB

Apache-2.0
Latest version published 6 years ago

Package Health Score

70 / 100
Full package analysis

Popular @cliqz-oss/dexie functions