GatherTownJS
  • 👋GatherTownJS
  • Information
    • 📣Announcements
    • ⛳Roadmap
    • 📜License
    • 📦Changelog
  • Getting Started
    • 📋Requirements
    • 📥Installation
    • 📖Basic Usage
Powered by GitBook
On this page

Was this helpful?

  1. Getting Started

Basic Usage

Learn the basics of using GatherTownJS.

Here's the basic example usage.

const GATHER = require('gathertown.js'); // add gather package
const access = require('./config.json'); // load your apikey
const gather = GATHER(access.key); // access keys

// some variables
const spaceId = 'space-id/space-name';
const mapId = 'map-name';

function map() {
  gather
    .getMap({ spaceId, mapId })
    .then((data) => console.log(data))
    .catch((err) => console.log(err));
}

map();

Here's the usage with hooks.

const { useGather } = require('gathertown.js');
const access = require('./config.json'); // load your apikey

// some variables
const spaceId = 'space-id/space-name';
const mapId = 'map-name';

function map() {
  // load only needed functions
  const { getMap } = useGather(access.key);

  getMap({ spaceId, mapId })
    .then((data) => console.log(data))
    .catch((err) => console.log(err));
}

map();
PreviousInstallation

Last updated 2 years ago

Was this helpful?

📖