I created a Ionic application where I try to connect to a hub.
I implemented the plugin in ts instead of js, however it gets stuck on "Scanning for Hubs" and the promise never resolve.
import { Component, OnInit } from '@angular/core';
import { PoweredUP } from 'node_modules/node-poweredup/dist/node/poweredup-browser';
@Component({
selector: 'app-poweredup',
templateUrl: './poweredup.component.html',
styleUrls: ['./poweredup.component.scss'],
})
export class PoweredupComponent implements OnInit {
constructor(public poweredUP: PoweredUP) {}
ngOnInit() {
this.poweredUP.on('discover', async (hub) => {
// Wait to discover a Hub
console.log(`Discovered ${hub.name}!`);
await hub.connect(); // Connect to the Hub
console.log('Connected');
});
}
scan() {
this.poweredUP.scan().then();
console.log('Scanning for Hubs...');
}
}
I searched in the async _discoveryEventHandler(server) function of poweredup-bowser.js to see where the scanning stop, and i found out that the event handler never goes through this line :
if (isLPF2Hub) {
hubType = await this._determineLPF2HubType(device);
}
The eventHandler seems to be stuck here and I can't find a solution. Any idea?
Hi,
I created a Ionic application where I try to connect to a hub. I implemented the plugin in ts instead of js, however it gets stuck on "Scanning for Hubs" and the promise never resolve.
I searched in the async _discoveryEventHandler(server) function of poweredup-bowser.js to see where the scanning stop, and i found out that the event handler never goes through this line :
The eventHandler seems to be stuck here and I can't find a solution. Any idea?