mirror of
https://github.com/fluencelabs/fluence-js.git
synced 2025-06-20 11:26:30 +00:00
Add option to print initiated particle ids (#147)
This commit is contained in:
@ -101,6 +101,17 @@ export interface PeerConfig {
|
||||
* Plugable AVM runner implementation. If not specified AvmBackgroundRunner will be used
|
||||
*/
|
||||
avmRunner?: AvmRunner;
|
||||
|
||||
/**
|
||||
* Enables\disabled various debugging features
|
||||
*/
|
||||
debug?: {
|
||||
/**
|
||||
* If set to true, newly initiated particle ids will be printed to console.
|
||||
* Useful to see what particle id is responsible for aqua function
|
||||
*/
|
||||
printParticleId?: boolean;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
@ -179,6 +190,10 @@ export class FluencePeer {
|
||||
this._keyPair = await KeyPair.randomEd25519();
|
||||
}
|
||||
|
||||
if (config?.debug?.printParticleId) {
|
||||
this._printParticleId = true;
|
||||
}
|
||||
|
||||
this._defaultTTL =
|
||||
config?.defaultTtlMs !== undefined // don't miss value 0 (zero)
|
||||
? config?.defaultTtlMs
|
||||
@ -262,6 +277,10 @@ export class FluencePeer {
|
||||
throw 'Cannot initiate new particle: peer is not initialized';
|
||||
}
|
||||
|
||||
if (this._printParticleId) {
|
||||
console.log('Particle id: ', particle.id);
|
||||
}
|
||||
|
||||
if (particle.initPeerId === undefined) {
|
||||
particle.initPeerId = this.getStatus().peerId;
|
||||
}
|
||||
@ -347,6 +366,7 @@ export class FluencePeer {
|
||||
|
||||
// Internal peer state
|
||||
|
||||
private _printParticleId: boolean = false;
|
||||
private _defaultTTL: number;
|
||||
private _relayPeerId: PeerIdB58 | null = null;
|
||||
private _keyPair: KeyPair;
|
||||
|
Reference in New Issue
Block a user