hypercore 10.0.0-alpha.55 → 10.0.0-alpha.56

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +4 -0
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -69,6 +69,7 @@ module.exports = class Hypercore extends EventEmitter {
69
69
  this.auth = opts.auth || null
70
70
  this.autoClose = !!opts.autoClose
71
71
  this.onwait = opts.onwait || null
72
+ this.wait = opts.wait !== false
72
73
 
73
74
  this.closing = null
74
75
  this.opening = this._openSession(key, storage, opts)
@@ -194,11 +195,13 @@ module.exports = class Hypercore extends EventEmitter {
194
195
  }
195
196
 
196
197
  const sparse = opts.sparse === false ? false : this.sparse
198
+ const wait = opts.wait === false ? false : this.wait
197
199
  const onwait = opts.onwait === undefined ? this.onwait : opts.onwait
198
200
  const Clz = opts.class || Hypercore
199
201
  const s = new Clz(this.storage, this.key, {
200
202
  ...opts,
201
203
  sparse,
204
+ wait,
202
205
  onwait,
203
206
  _opening: this.opening,
204
207
  _sessions: this.sessions
@@ -682,6 +685,7 @@ module.exports = class Hypercore extends EventEmitter {
682
685
  if (this.cache) this.cache.set(index, block)
683
686
  } else {
684
687
  if (opts && opts.wait === false) return null
688
+ if (this.wait === false && (!opts || !opts.wait)) return null
685
689
  if (opts && opts.onwait) opts.onwait(index, this)
686
690
  if (this.onwait) this.onwait(index, this)
687
691
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hypercore",
3
- "version": "10.0.0-alpha.55",
3
+ "version": "10.0.0-alpha.56",
4
4
  "description": "Hypercore 10",
5
5
  "main": "index.js",
6
6
  "scripts": {