Just ran the main example given in the README and encountered the following error, with nothing displayed in the main window.
bundle.js:4059 Uncaught TypeError: Array.prototype.join called on null or undefined
at join (native)
at Stream.<anonymous> (http://localhost:8000/bundle.js:4059:35)
...
The error refers to line 31 in index.js. The issue is that the key is assumed to be an array, and this is not the case in the example.
After fixing that issue, a second issue I encountered is that the live stream presents some events the code doesn't deal with. Here is the live stream that I get when running the example.
The result is that the list displays undefined a couple of times.
undefined
undefined
Sat Dec 16 2017 00:36:37 GMT-0600 (CST)
Sat Dec 16 2017 00:36:38 GMT-0600 (CST)
I am just learning level, this is the first example I have tried, so I don't know why the live stream works that way. Anyway, here is my solution to fix both issues and get the example code working.
index.js
30 self.stream = live(self.db, function (change) {
31 if (!('key' in change && 'type' in change)) return;
32
33 var id = Array.isArray(change.key) ?
34 Array.prototype.join.call(change.key, "") : change.key;
35 var row;
36
37 // delete?
Let me know if you would like a pull request. Thanks for this project, it has really helped introduced me to level.
Just ran the main example given in the README and encountered the following error, with nothing displayed in the main window.
The error refers to line 31 in index.js. The issue is that the key is assumed to be an array, and this is not the case in the example.
After fixing that issue, a second issue I encountered is that the live stream presents some events the code doesn't deal with. Here is the live stream that I get when running the example.
The result is that the list displays undefined a couple of times.
I am just learning level, this is the first example I have tried, so I don't know why the live stream works that way. Anyway, here is my solution to fix both issues and get the example code working.
index.js
Let me know if you would like a pull request. Thanks for this project, it has really helped introduced me to level.
Matt