ggbgg

package to collect data from boardgamegeek

Usage no npm install needed!

<script type="module">
  import ggbgg from 'https://cdn.skypack.dev/ggbgg';
</script>

README

GGBGG

Shorthand fo Guerilla Gamers bgg, this package offers wrappers and parsers of boardgame geek data.

use

Due to the nature of the javascript asynchronous getters, functios generally return promises to be handled on users part. Last results are cached and so can be collected after the call has finished

// getting terraforming mars data
var game = ggbgg.get.item(167791)
game.then(g => {console.log(g);});

// assigning to a variable
var game = null;
ggbgg.get.game('Terra Mystica').then(g => {game = g;});

//getting data from the cached response
ggbgg.get.game('Terra Mystica')
setTimeout(()=>{
  console.log(ggbgg.get.results());
}, 2000);

Collections and plays

Issue with BGG is that it needs time to prepare the collecion before it can be downlaoded. So you end up calling the function multiple times. The default function tries three times with 3s separation, after that you need to call on your own.

var collection = bgg.get.collection('username', {});
out = null;
collection.then(c => {out = c});