1.0.0 • Published 6 years ago

@thclab/vue-idb v1.0.0

Weekly downloads
23
License
MIT
Repository
github
Last release
6 years ago

vue-idb

IndexedDB wrapper for Vuejs based on Dexie

Install

npm install vue-idb --save

Usage

import Vue from 'vue'
import VueIdb from 'vue-idb'

Vue.use(VueIdb)

const dbName = "database"

const idb = new VueIdb(database, [{
  version: 1,
  schemas: [
    { tests: 'id, title, created_at, updated_at' },
			{ posts: 'id, owner' }
  ]
},
{
  version: 2,
  schemas: [
    { cars: 'id, name, created_at, updated_at'},
  ],
  upgrade: function(tx) {
    return tx.tests.toCollection().modify(item => {
      // modify your table
    })
  }
})

new Vue({
  el: '#app',
  idb: idb,
  render: h => h(App)
})