holepunch-hop 0.1.9 → 0.2.0

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "holepunch-hop",
3
- "version": "0.1.9",
3
+ "version": "0.2.0",
4
4
  "description": "data interface to HOP",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
package/src/bees.js CHANGED
@@ -204,14 +204,25 @@ class HyperBee extends EventEmitter {
204
204
  return chatData
205
205
  }
206
206
 
207
+ /**
208
+ * save space menu
209
+ * @method saveSpaceHistory
210
+ *
211
+ */
212
+ saveSpaceHistory = async function (spaceContract) {
213
+ await this.dbBentospaces.put(spaceContract.space.spaceid, spaceContract)
214
+ let checkSave = await this.getBentospace(spaceContract.space.spaceid)
215
+ return checkSave
216
+ }
217
+
207
218
  /**
208
219
  * save space layout of bentobox
209
220
  * @method saveBentospace
210
221
  *
211
222
  */
212
223
  saveBentospace = async function (spaceContract) {
213
- await this.dbBentospaces.put(spaceContract.space.spaceid, spaceContract)
214
- let checkSave = await this.getBentospace(spaceContract.space.spaceid)
224
+ await this.dbBentospaces.put(spaceContract.spaceid, spaceContract)
225
+ let checkSave = await this.getBentospace(spaceContract.spaceid)
215
226
  return checkSave
216
227
  }
217
228
 
@@ -231,7 +242,7 @@ class HyperBee extends EventEmitter {
231
242
  *
232
243
  */
233
244
  deleteBentospace = async function (space) {
234
- const deleteStatus = await this.dbBentospaces.del(key)
245
+ const deleteStatus = await this.dbBentospaces.del(space.spaceid)
235
246
  let deleteInfo = {}
236
247
  deleteInfo.spaceid = space.spaceid
237
248
  return deleteInfo
package/src/index.js CHANGED
@@ -100,9 +100,10 @@ class HolepunchWorker extends EventEmitter {
100
100
  this.Peers.on('connect-warm', (data) => {
101
101
  let peerId = {}
102
102
  peerId.name = 'new-peer'
103
- peerId.publickkey = data
103
+ peerId.publickey = data
104
104
  peerId.datastore = ''
105
105
  this.warmPeers.push(peerId)
106
+ this.emit('peer-incoming', peerId)
106
107
  })
107
108
  }
108
109