vue-level

1.0.0 • Public • Published

vue-level

A wrapper of level-js for Vue.

Install

$ npm install vue-level --save-dev

Usage

import Vue from 'vue';
import VueLevel from 'vue-level';

Vue.use(VueLevel);

// then use this.$db to access your database.

You can set options like this, it's not necessary:

Vue.use(VueLevel, {
  name: 'my-database', // name of your db, default is site-data
  levelOptions: { // options pass to level
    prefix: 'level-',
    version: 1,
  },
  shortcuts: true, // if set to true, we will add some functions, default is false
});

// shortcuts

await this.$dbGet(key);
await this.$dbSet(key, value); // key must be a string
await this.$dbPut(key, value); // same as this.$dbSet

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i vue-level

Weekly Downloads

0

Version

1.0.0

License

none

Unpacked Size

3.23 kB

Total Files

4

Last publish

Collaborators

  • backrunner