corestore 7.4.2 → 7.4.3

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 +3 -0
  2. package/package.json +3 -2
package/index.js CHANGED
@@ -4,6 +4,7 @@ const ReadyResource = require('ready-resource')
4
4
  const sodium = require('sodium-universal')
5
5
  const crypto = require('hypercore-crypto')
6
6
  const ID = require('hypercore-id-encoding')
7
+ const { isAndroid } = require('which-runtime')
7
8
  const { STORAGE_EMPTY } = require('hypercore-errors')
8
9
 
9
10
  const auditStore = require('./lib/audit.js')
@@ -239,6 +240,7 @@ class Corestore extends ReadyResource {
239
240
  this.primaryKey = this.root ? this.root.primaryKey : (opts.primaryKey || null)
240
241
  this.ns = opts.namespace || DEFAULT_NAMESPACE
241
242
  this.manifestVersion = opts.manifestVersion || 1
243
+ this.shouldSuspend = isAndroid ? !!opts.suspend : opts.suspend !== false
242
244
 
243
245
  this.watchers = null
244
246
  this.watchIndex = -1
@@ -289,6 +291,7 @@ class Corestore extends ReadyResource {
289
291
  async suspend ({ log = noop } = {}) {
290
292
  await log('Flushing db...')
291
293
  await this.storage.db.flush()
294
+ if (!this.shouldSuspend) return
292
295
  await log('Suspending db...')
293
296
  await this.storage.db.suspend()
294
297
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "corestore",
3
- "version": "7.4.2",
3
+ "version": "7.4.3",
4
4
  "description": "A Hypercore factory that simplifies managing collections of cores.",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -14,7 +14,8 @@
14
14
  "hypercore-errors": "^1.4.0",
15
15
  "hypercore-id-encoding": "^1.3.0",
16
16
  "ready-resource": "^1.1.1",
17
- "sodium-universal": "^5.0.1"
17
+ "sodium-universal": "^5.0.1",
18
+ "which-runtime": "^1.2.1"
18
19
  },
19
20
  "devDependencies": {
20
21
  "brittle": "^3.7.0",