πŸ“–
Basic Usage
Learn the basics of using GatherTownJS.
Here's the basic example usage.
1
const GATHER = require('gathertown.js'); // add gather package
2
const access = require('./config.json'); // load your apikey
3
const gather = GATHER(access.key); // access keys
4
​
5
// some variables
6
const spaceId = 'space-id/space-name';
7
const mapId = 'map-name';
8
​
9
function map() {
10
gather
11
.getMap({ spaceId, mapId })
12
.then((data) => console.log(data))
13
.catch((err) => console.log(err));
14
}
15
​
16
map()ava
Copied!
Here's the usage with hooks.
1
const { useGather } = require('gathertown.js');
2
const access = require('./config.json'); // load your apikey
3
​
4
// some variables
5
const spaceId = 'space-id/space-name';
6
const mapId = 'map-name';
7
​
8
function map() {
9
// load only needed functions
10
const { getMap } = useGather(access.key);
11
​
12
getMap({ spaceId, mapId })
13
.then((data) => console.log(data))
14
.catch((err) => console.log(err));
15
}
16
​
17
map();
Copied!
Copy link