git ssb

0+

wanderer🌟 / js-dfinity-radix-tree



Commit eb2b91e814ad8589fb6c3b7c0c1d9714a040b688

minor fixes

Norton Wang committed on 4/5/2018, 6:57:13 PM
Parent: 0c0780cf35124713c92ed547b31057ee945069f8

Files changed

package.jsonchanged
remoteDatastore.jschanged
fetch.jsadded
package.jsonView
@@ -33,8 +33,11 @@
3333 "node-fetch": "^2.1.2",
3434 "text-encoding": "^0.6.4",
3535 "uint1array": "^1.0.5"
3636 },
37+ "browser": {
38+ "node-fetch": "./fetch.js"
39+ },
3740 "standard": {
3841 "ignore": [
3942 "/benchmark/"
4043 ]
remoteDatastore.jsView
@@ -1,7 +1,7 @@
11 const Buffer = require('safe-buffer').Buffer
22 const TreeDAG = require('./datastore.js')
3-const fetch = typeof window !== 'undefined' ? window.fetch : require('node-fetch')
3+const fetch = require('node-fetch')
44
55 module.exports = class RemoteTreeDAG extends TreeDAG {
66 /**
77 * @param dag {object} a level db instance
@@ -20,13 +20,13 @@
2020
2121 async get (link) {
2222 try {
2323 return await super.get(link)
24- } catch (e) {}
25-
26- if (this.remoteOpts.uri) {
27- await this.fetchRemote(link)
28- return super.get(link)
24+ } catch (e) {
25+ if (this.remoteOpts.uri) {
26+ await this.fetchRemote(link)
27+ return super.get(link)
28+ }
2929 }
3030 }
3131
3232 fetchRemote (key) {
fetch.jsView
@@ -1,0 +1,1 @@
1+module.exports = window.fetch

Built with git-ssb-web