@leofcoin/peernet 1.0.10 → 1.0.11

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.
@@ -0,0 +1,14 @@
1
+ # breaking changes
2
+ ## 1.0.10
3
+ ### start
4
+ #### before
5
+ ```js
6
+ const node = await new Node()
7
+ ```
8
+
9
+ #### now
10
+ ```js
11
+ const node = await new Node()
12
+ // gives time to setup things...
13
+ await node.start()
14
+ ```
package/README.md CHANGED
@@ -11,7 +11,9 @@ const config = {
11
11
  stars: ['wss://peach.leofcoin.org']
12
12
  }
13
13
 
14
- await new Peernet(config)
14
+ const node = await new Peernet(config)
15
+ // ... setup some things
16
+ await node.start()
15
17
 
16
18
  console.log(globalThis.peernet)
17
19
  ```
@@ -1,4 +1,4 @@
1
- import { L as LittlePubSub } from './peernet-7ba6837f.js';
1
+ import { L as LittlePubSub } from './peernet-c184b33c.js';
2
2
  import './value-157ab062.js';
3
3
 
4
4
  var clientApi = _pubsub => {
@@ -1,4 +1,4 @@
1
- import { M as MultiWallet, e as encrypt, b as base58$1 } from './peernet-7ba6837f.js';
1
+ import { M as MultiWallet, e as encrypt, b as base58$1 } from './peernet-c184b33c.js';
2
2
  import './value-157ab062.js';
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { F as FormatInterface } from './peernet-7ba6837f.js';
1
+ import { F as FormatInterface } from './peernet-c184b33c.js';
2
2
  import './value-157ab062.js';
3
3
 
4
4
  var proto$b = {
@@ -16082,7 +16082,7 @@ class Identity {
16082
16082
  globalThis.peernet.selectedAccount = new TextDecoder().decode(selected);
16083
16083
  }
16084
16084
  else {
16085
- const importee = await import(/* webpackChunkName: "generate-account" */ './index-84ee0e0b.js');
16085
+ const importee = await import(/* webpackChunkName: "generate-account" */ './index-a3af83e4.js');
16086
16086
  const { identity, accounts } = await importee.default(password, this.network);
16087
16087
  await globalThis.accountStore.put('public', JSON.stringify({ walletId: identity.walletId }));
16088
16088
  await globalThis.walletStore.put('version', String(1));
@@ -16248,7 +16248,7 @@ class Peernet {
16248
16248
  this.root = options.root;
16249
16249
  const { RequestMessage, ResponseMessage, PeerMessage, PeerMessageResponse, PeernetMessage, DHTMessage, DHTMessageResponse, DataMessage, DataMessageResponse, PsMessage, ChatMessage, PeernetFile
16250
16250
  // FolderMessageResponse
16251
- } = await import(/* webpackChunkName: "messages" */ './messages-def41fbf.js');
16251
+ } = await import(/* webpackChunkName: "messages" */ './messages-c871d6f3.js');
16252
16252
  /**
16253
16253
  * proto Object containing protos
16254
16254
  * @type {Object}
@@ -16297,12 +16297,6 @@ class Peernet {
16297
16297
  * @see DataHandler
16298
16298
  */
16299
16299
  pubsub.subscribe('peer:data', dataHandler);
16300
- const importee = await import('./client-bbd6e332.js');
16301
- /**
16302
- * @access public
16303
- * @type {PeernetClient}
16304
- */
16305
- this.client = new importee.default(this.id, this.networkVersion, this.stars);
16306
16300
  if (globalThis.navigator) {
16307
16301
  globalThis.addEventListener('beforeunload', async () => this.client.close());
16308
16302
  }
@@ -16315,6 +16309,17 @@ class Peernet {
16315
16309
  }
16316
16310
  return this;
16317
16311
  }
16312
+ async start() {
16313
+ this.starting = true;
16314
+ const importee = await import('./client-0d28cffd.js');
16315
+ /**
16316
+ * @access public
16317
+ * @type {PeernetClient}
16318
+ */
16319
+ this.client = new importee.default(this.id, this.networkVersion, this.stars);
16320
+ this.started = true;
16321
+ this.starting = false;
16322
+ }
16318
16323
  addRequestHandler(name, method) {
16319
16324
  this.requestProtos[name] = method;
16320
16325
  }
@@ -1,2 +1,2 @@
1
- export { P as default } from './peernet-7ba6837f.js';
1
+ export { P as default } from './peernet-c184b33c.js';
2
2
  import './value-157ab062.js';
@@ -555,12 +555,6 @@ class Peernet {
555
555
  * @see DataHandler
556
556
  */
557
557
  pubsub.subscribe('peer:data', dataHandler);
558
- const importee = await import('@leofcoin/peernet-swarm/client');
559
- /**
560
- * @access public
561
- * @type {PeernetClient}
562
- */
563
- this.client = new importee.default(this.id, this.networkVersion, this.stars);
564
558
  if (globalThis.navigator) {
565
559
  globalThis.addEventListener('beforeunload', async () => this.client.close());
566
560
  }
@@ -573,6 +567,17 @@ class Peernet {
573
567
  }
574
568
  return this;
575
569
  }
570
+ async start() {
571
+ this.starting = true;
572
+ const importee = await import('@leofcoin/peernet-swarm/client');
573
+ /**
574
+ * @access public
575
+ * @type {PeernetClient}
576
+ */
577
+ this.client = new importee.default(this.id, this.networkVersion, this.stars);
578
+ this.started = true;
579
+ this.starting = false;
580
+ }
576
581
  addRequestHandler(name, method) {
577
582
  this.requestProtos[name] = method;
578
583
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leofcoin/peernet",
3
- "version": "1.0.10",
3
+ "version": "1.0.11",
4
4
  "description": "",
5
5
  "main": "src/peernet.js",
6
6
  "exports": {
package/src/peernet.ts CHANGED
@@ -235,13 +235,6 @@ export default class Peernet {
235
235
  */
236
236
  pubsub.subscribe('peer:data', dataHandler)
237
237
 
238
-
239
- const importee = await import('@leofcoin/peernet-swarm/client')
240
- /**
241
- * @access public
242
- * @type {PeernetClient}
243
- */
244
- this.client = new importee.default(this.id, this.networkVersion, this.stars)
245
238
  if (globalThis.navigator) {
246
239
  globalThis.addEventListener('beforeunload', async () => this.client.close());
247
240
  } else {
@@ -254,6 +247,18 @@ export default class Peernet {
254
247
  return this
255
248
  }
256
249
 
250
+ async start() {
251
+ this.starting = true
252
+ const importee = await import('@leofcoin/peernet-swarm/client')
253
+ /**
254
+ * @access public
255
+ * @type {PeernetClient}
256
+ */
257
+ this.client = new importee.default(this.id, this.networkVersion, this.stars)
258
+ this.started = true
259
+ this.starting = false
260
+ }
261
+
257
262
  addRequestHandler(name, method) {
258
263
  this.requestProtos[name] = method
259
264
  }