0.0.3 • Published 5 years ago

hackbox-client v0.0.3

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

hackbox-client

A Jackbox inspired framework for creating party games - client component.

Usage

const hackboxClient = require("hackbox-client");

Hosting

async componentDidMount() {
  const hackbox = await hackboxClient("http://localhost:8080");
  const room = await hackbox.createRoom();
  this.setState(() => ({ room }));

  hackbox.onPlayerJoin(room => {
    this.setState(() => ({ room }));
  });
}

Joining a Room

const hackbox = await hackboxClient("http://localhost:8080");
const playerId = await hackbox.joinRoom(roomId, name);