score:4

let currentKey = '';

poll(() => {
  if (/* wallet available and connected */) {
    await /* Action that updates publicKey */
    if (currentKey !== wallet.publicKey.toBase58()) {
      currentKey = wallet.publicKey.toBase58();
      this.publicKey = wallet.publicKey;
      this.emit('change')
    }
  }
})

Related Query

More Query from same tag