Dexie.js: Cannot read property 'subscribe' of undefined

Created on 24 Mar 2018  路  2Comments  路  Source: dfahlander/Dexie.js

hi, there:
when I use Dexie.js in Vue.js,
code in database.js:

import Dexie from "dexie";
const db = new Dexie("TS_EASEMOB_H5");
db.debug = "dexie";
db.on('error', () => {
  console.log(1);
});
db.on('ready', () => {
  console.log(2);
});

db.on('populate', () => {
  console.log(3);
});

db.on('blocked', () => {
  console.log(4);
});

db.on('versionchange', () => {
  console.log(5);
});
db.version(1).stores({
  /*message*/
  message: "id, time, cid, type, mid, uid, touid, txt, read, [cid+read]",
  /*room*/
  room:
    "++id, group, title, type, mid, uid, last_message_time, last_message_txt, del, [mid+del], [mid+uid], [mid+group]"
});

export default db;

I import this module my component
import database from "database.js";

error is coming:
with db.on('error', () => ());
and 2 will be output in console;

dexie.es.js?6304:1394 Uncaught TypeError: Cannot read property 'subscribe' of undefined
    at Dexie.rv [as on] (dexie.es.js?6304:1394)
    at eval (database.js?ced5:5)
    at Object../src/util/database.js (app.js:6000)
    at __webpack_require__ (app.js:708)
    at fn (app.js:113)
    at eval (init.js:9)
    at Object../src/easemob/init.js (app.js:5413)
    at __webpack_require__ (app.js:708)
    at fn (app.js:113)
    at eval (eval at ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"/Users/wayne/www/plus/packages/plus-component-h5/node_modules/.cache/cache-loader"}!./node_modules/babel-loader/lib/index.js!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./src/page/message/msg.vue (app.js:1395), <anonymous>:2:75)

and I need some help
System: macOS 10.13.3
agent: Chrome 65.0.3325.181
Vue.js: 2.5.13
Dexie: 2.0.2

if I remove on.error, there is no error, no warring, everything is ok but no database created

All 2 comments

It's a mistake, please ignore

@zhiyicx would you care to share what the issue was? I'm facing exactly the same issue, even when using vue-idb... Cheers

Was this page helpful?
0 / 5 - 0 ratings

Related issues

remusao picture remusao  路  3Comments

Script47 picture Script47  路  3Comments

dmlzj picture dmlzj  路  3Comments

acicali picture acicali  路  4Comments

fulltic picture fulltic  路  4Comments