I try to use sonos (https://www.npmjs.org/package/sonos) to return an array of the players i have on my network. I would like to use the sonos.search function to find players for me at startup and afterwards update the array with new players if connected to the network.
Since sonos.search is asynchronous the rest of the code will execute before all players are added to the array at startup. How can I block the code to run the sonos.search once for 10 seconds at startup building an array of players that is on the network and then liste/search for new players and add to array if connected?
-