pear-runtime-updater 0.0.11 → 0.0.12

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 (3) hide show
  1. package/README.md +6 -2
  2. package/index.js +7 -5
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -8,6 +8,10 @@ npm install pear-runtime-updater
8
8
 
9
9
  Listens for P2P over-the-air (OTA) updates for [Pear](https://docs.pears.com) apps. Replicates from a pear upgrade link and emits when a new version is available.
10
10
 
11
+ ## MVP - EXPERIMENTAL
12
+
13
+ This boilerplate is MVP and Experimental.
14
+
11
15
  ## Usage
12
16
 
13
17
  ```js
@@ -59,7 +63,7 @@ process.on('beforeExit', () => updater.close())
59
63
 
60
64
  #### `updater.on('updating')`
61
65
 
62
- Emitted when an update is in progress (download started).
66
+ Emitted when an update is in progress.
63
67
 
64
68
  #### `updater.on('updating-delta', data)`
65
69
 
@@ -79,7 +83,7 @@ Apply the update by swapping the current app with the received build through ato
79
83
 
80
84
  #### `await updater.close()`
81
85
 
82
- Closes the updater. Call when shutting down the app.
86
+ Shut it down. You should do this when closing your app for best performance.
83
87
 
84
88
  ## License
85
89
 
package/index.js CHANGED
@@ -32,17 +32,15 @@ module.exports = class PearRuntime extends ReadyResource {
32
32
  this.length = upgrade.length || 0
33
33
  this.fork = upgrade.fork || 0
34
34
  this.link = link.serialize({ drive: { fork: this.fork, length: this.length, key: this.key } })
35
- this.store = new Corestore(path.join(this.dir, 'pear-runtime/corestore'))
36
- this.drive = new Hyperdrive(this.store, this.key)
37
35
  } else {
38
36
  this.key = null
39
37
  this.length = null
40
38
  this.fork = null
41
39
  this.link = null
42
- this.store = null
43
- this.drive = null
44
40
  }
45
41
 
42
+ this.store = null
43
+ this.drive = null
46
44
  this.swarm = null
47
45
  this.next = null
48
46
  this.checkout = null
@@ -53,7 +51,11 @@ module.exports = class PearRuntime extends ReadyResource {
53
51
  }
54
52
 
55
53
  async _open() {
56
- if (!this.updates) return
54
+ if (!this.drive) return
55
+ if (this.store === null) {
56
+ this.store = new Corestore(path.join(this.dir, 'pear-runtime/corestore'))
57
+ }
58
+ if (this.drive === null) this.drive = new Hyperdrive(this.store, this.key)
57
59
  await this.drive.ready()
58
60
 
59
61
  if (this.bundled) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pear-runtime-updater",
3
- "version": "0.0.11",
3
+ "version": "0.0.12",
4
4
  "description": "Listens for OTA Pear App updates",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Holepunch Inc",