Skip to content

Application API

Michel Gutierrez edited this page Apr 2, 2017 · 4 revisions

Basics

You can integrate Jocly on either:

  • the browser: a Web page, a HTML5 mobile app (via Ionic/Cordova), a HTML5 desktop app (via Electron or Nwjs)
  • node.js: server or local applications

We assume that the entry point of the Jocly Application API is a Jocly variable you obtain:

  • on a browser, by inserting <script src="jocly/jocly.js"><script> (Jocly is now a global variable)
  • on node.js, via const Jocly = require("jocly");

Methods from the Jocly Application API never returns a value directly and you should never assume that an action has been performed right after you called the corresponding method. Instead, all methods return Promise objects.

Example:

Jocly.listGames()
  .then(function(games) {
    // do something with the games array
  });

API Objects

  • Jocly: access to the Jocly top-level features
  • Match: instance of a running game
Clone this wiki locally