Developer API

The Gig Game Developer API provides a comprehensive suite of tools for integrating with our gaming platform. It offers robust functionalities for managing user profiles, accessing game data, and interacting with our game's ecosystem, making it ideal for developers looking to enhance their games with rich features and seamless connectivity.

Key Modules

This guide provides developers with the essential information and tools needed to build rich, interactive gaming experiences.

1. Server Communications Overview

  • Related Namespace: $GG.server
  • Description: Learn how to manage server interactions, handle events, and synchronize data effectively.

2. The Asset Manager Overview

  • Related Namespace: $GG.ui.assets
  • Description: Discover methods for efficiently loading, managing, and utilizing game assets such as images, videos, and audio files.

3. The HUD Manager Overview

  • Related Namespace: $GG.ui.hud
  • Description: Discover methods for displaying and extending the HUD.

4. The Audio Manager Overview

  • Related Namespace: $GG.ui.audio
  • Description: Understand the functionalities for audio playback, control, and manipulation within your game.

5. The Input Manager Overview

  • Related Namespace: $GG.ui.input
  • Description: Explore how to handle user input events to enhance interactivity and responsiveness in your game.

6. Visual FX Manager Overview

  • Related Namespace: $GG.ui.visual
  • Description: Learn about managing visual effects, including stage props, transitions, and other visual properties.

7. Using Globalization

  • Related Namespace: $GG.globalization
  • Description: Get familiar with tools and techniques for implementing multilingual support and managing translations.

8. Two-Way Web View Binding

  • Related Namespace: $GG.web
  • Description: Discover how to bind web views to controller classes using the Handlebars library for dynamic content rendering.

These modules provide a foundational understanding of each manager's role and capabilities, ensuring you can leverage the full potential of the Gig Game Developer API in your projects.

Core Communications API

This is the core communications library for the Gig Game Developer API. It facilitates server interactions, event management, and data handling within the Gig gaming platform. The $GG namespace includes modules for attaching and detaching event listeners, broadcasting events, managing leaderboards, synchronizing players, uploading images, and performing AJAX requests. Additionally, it provides utility functions to retrieve configuration details such as mode, CDN URL, server URL, game keys, QR codes, user keys, and language codes, ensuring efficient game development and integration.

Including In Html

<head>
    ...
    <script src="https://launch.gig.game/api/js?key={API KEY HERE}"></script>
    ...
</head>
document.addEventListener("DOMContentLoaded", function () {
    //wait for gig games to establish a connection
    $GG.server.attachEvent("OnReady", () => {
		// we are online and ready to start!
    });
});

📂 server

Description:
Communications with server. Learn More


attachEvent

Signature:
$GG.server.attachEvent(eventName: string, fn: fn, priority: number) ⇒ void

Description:
Attaches an event listener.

Returns:
void

Parameters:

Name Type Default Description
eventName string - The event name.
fn fn - The event listener.
priority number 1 Controls priority order of events fired.

detachEvent

Signature:
$GG.server.detachEvent(eventName: string, fn: fn) ⇒ void

Description:
Detaches an event listener. If connection is down, this is discarded.

Returns:
void

Parameters:

Name Type Default Description
eventName string - The event name.
fn fn - The event listener.

broadcastToEngine

Signature:
$GG.server.broadcastToEngine(eventName: string, options: object) ⇒ void

Description:
Broadcasts an event to the engine. If connection is down, this is discarded.

Returns:
void

Parameters:

Name Type Default Description
eventName string - The event name.
options object null Optional event options.

broadcastToHost

Signature:
$GG.server.broadcastToHost(eventName: string, options: object) ⇒ void

Description:
Broadcasts an event to the host. If connection is down, this is discarded.

Returns:
void

Parameters:

Name Type Default Description
eventName string - The event name.
options object null Optional event options.

broadcastToPlayer

Signature:
$GG.server.broadcastToPlayer(playerId: string, eventName: string, options: object) ⇒ void

Description:
Broadcasts an event to a specific player. If connection is down, this is discarded.

Returns:
void

Parameters:

Name Type Default Description
playerId string - The player ID.
eventName string - The event name.
options object null Optional event options.

broadcastToPlayers

Signature:
$GG.server.broadcastToPlayers(eventName: string, options: object) ⇒ void

Description:
Broadcasts an event to all players. If connection is down, this is discarded.

Returns:
void

Parameters:

Name Type Default Description
eventName string - The event name.
options object null Optional event options.

queueToEngine

Signature:
$GG.server.queueToEngine(eventName: string, options: object) ⇒ void

Description:
Broadcasts an event to the engine. Gaurantees eventual transmission.

Returns:
void

Parameters:

Name Type Default Description
eventName string - The event name.
options object null Optional event options.

queueToHost

Signature:
$GG.server.queueToHost(eventName: string, options: object) ⇒ void

Description:
Broadcasts an event to the host. Gaurantees eventual transmission.

Returns:
void

Parameters:

Name Type Default Description
eventName string - The event name.
options object null Optional event options.

queueToPlayer

Signature:
$GG.server.queueToPlayer(playerId: string, eventName: string, options: object) ⇒ void

Description:
Broadcasts an event to a specific player. Gaurantees eventual transmission.

Returns:
void

Parameters:

Name Type Default Description
playerId string - The player ID.
eventName string - The event name.
options object null Optional event options.

queueToPlayers

Signature:
$GG.server.queueToPlayers(eventName: string, options: object) ⇒ void

Description:
Queues an event to all players. Gaurantees eventual transmission.

Returns:
void

Parameters:

Name Type Default Description
eventName string - The event name.
options object null Optional event options.

trigger

Signature:
$GG.server.trigger(eventName: string, options: object) ⇒ void

Description:
Triggers a local event.

Returns:
void

Parameters:

Name Type Default Description
eventName string - The event name.
options object null Optional event options.

setToLeaderboard

Signature:
$GG.server.setToLeaderboard(leaderboardName: string, playerId: string, score: number) ⇒ void

Description:
Sets a player's score on the leaderboard.

Returns:
void

Parameters:

Name Type Default Description
leaderboardName string - The name of the leaderboard.
playerId string - The player ID.
score number - The player's score.

syncPlayersToHost

Signature:
$GG.server.syncPlayersToHost() ⇒ void

Description:
Synchronizes players with the host.

Returns:
void


uploadImage

Signature:
$GG.server.uploadImage(base64Data: string) ⇒ Promise

Description:
Uploads an image to the server.

Returns:
Promise

Parameters:

Name Type Default Description
base64Data string - The base64 encoded image data.

ajax

Signature:
$GG.server.ajax(options: object) ⇒ Promise

Description:
Performs an AJAX request to the server.

Returns:
Promise

Parameters:

Name Type Default Description
options object - AJAX request options.

📂 types

Description:
Server communication types.


service

Signature:
$GG.server.types.service()

Description:
Class extended for calling Gig Game API endpoints.


getMode

Signature:
$GG.getMode() ⇒ string

Description:
Gets the current mode. controller||host

Returns:
string


getCDN

Signature:
$GG.getCDN() ⇒ string

Description:
Gets the CDN URL.

Returns:
string


getServer

Signature:
$GG.getServer() ⇒ string

Description:
Gets the server URL.

Returns:
string


getGameKey

Signature:
$GG.getGameKey() ⇒ string

Description:
Gets the game key.

Returns:
string


getGameCode

Signature:
$GG.getGameCode() ⇒ string

Description:
Gets the game code.

Returns:
string


getQrCode

Signature:
$GG.getQrCode() ⇒ string

Description:
Gets the game QR code URL.

Returns:
string


getUserKey

Signature:
$GG.getUserKey() ⇒ string

Description:
Gets the user key.

Returns:
string


getLanguage

Signature:
$GG.getLanguage() ⇒ string

Description:
Gets the language code.

Returns:
string


User Interface API

Including In Html

<head>
    ...
    <script src="https://launch.gig.game/api/js?key={API KEY HERE}&libraries=ui"></script>
    ...
</head>

Initializing the UI to current window

document.addEventListener("DOMContentLoaded", function () {
    //wait for gig games to establish a connection
    $GG.server.attachEvent("OnReady", () => {

		$GG.ui.initialize(window, true)
		  .then(() => {
		    console.log("UI initialized with Three.js support.");
		  })
		  .catch((error) => {
		    console.error("Initialization failed:", error);
		  });

    });
});

Initializing the UI to the HUD

Note: There is no need to call initialize in this scenario because the HUD automatically initializes itself and redirects the UI library to its own canvas.

document.addEventListener("DOMContentLoaded", function () {

    // Open the HUD if it's not already open
    $GG.ui.hud.launcher.open();

    // Get the current HUD stage
    var stage = $GG.ui.hud.launcher.getStage();

});

Quick Note About Three.js

Three.js is a powerful and popular JavaScript library used to create and display animated 3D graphics in a web browser. It provides an easy-to-use API for rendering complex 3D scenes, allowing developers to create immersive and interactive visual experiences. The $GG.ui library supports integration with Three.js, enabling advanced 3D graphics and animations within the user interface. This support allows for seamless incorporation of 3D elements alongside traditional 2D UI components, enhancing the visual appeal and functionality of applications. For more information about Three.js and its capabilities, you can visit the Three.js project documentation.

We will be adding examples of how to use Three.js with our library very soon. In the meantime, if you want to get a quick start, you can obtain your Three.js renderer by calling $GG.ui.visual.activeStage.getThreeRenderer().


📂 assets

Description:
Asset manager endpoints. Learn More


loadAssetFile

Signature:
$GG.ui.assets.loadAssetFile(path: string) ⇒ Promise

Description:
Loads the asset file and returns a promise.

Returns:
Promise

Parameters:

Name Type Default Description
path string - Path to the asset file

loadImage

Signature:
$GG.ui.assets.loadImage(path: string) ⇒ Promise

Description:
Loads an image and returns a promise.

Returns:
Promise

Parameters:

Name Type Default Description
path string - Path to the image file

loadVideo

Signature:
$GG.ui.assets.loadVideo(path: string) ⇒ Promise

Description:
Loads a video and returns a promise.

Returns:
Promise

Parameters:

Name Type Default Description
path string - Path to the video file

loadAudio

Signature:
$GG.ui.assets.loadAudio(path: string) ⇒ Promise

Description:
Loads an audio file and returns a promise.

Returns:
Promise

Parameters:

Name Type Default Description
path string - Path to the audio file

preloadVideo

Signature:
$GG.ui.assets.preloadVideo(name: string, path: string) ⇒ Promise

Description:
Preloads a video and returns a promise.

Returns:
Promise

Parameters:

Name Type Default Description
name string - Name of the video
path string - Path to the video file

preloadImage

Signature:
$GG.ui.assets.preloadImage(name: string, path: string) ⇒ Promise

Description:
Preloads an image and returns a promise.

Returns:
Promise

Parameters:

Name Type Default Description
name string - Name of the image
path string - Path to the image file

preloadAudio

Signature:
$GG.ui.assets.preloadAudio(name: string, path: string) ⇒ Promise

Description:
Preloads an audio file and returns a promise.

Returns:
Promise

Parameters:

Name Type Default Description
name string - Name of the audio
path string - Path to the audio file

getAudio

Signature:
$GG.ui.assets.getAudio(name: string) ⇒ object

Description:
Gets an audio asset by name.

Returns:
object

Parameters:

Name Type Default Description
name string - Name of the audio

getImage

Signature:
$GG.ui.assets.getImage(name: string) ⇒ object

Description:
Gets an image asset by name.

Returns:
object

Parameters:

Name Type Default Description
name string - Name of the image

getVideo

Signature:
$GG.ui.assets.getVideo(name: string) ⇒ object

Description:
Gets a video asset by name.

Returns:
object

Parameters:

Name Type Default Description
name string - Name of the video

getSpriteLoop

Signature:
$GG.ui.assets.getSpriteLoop(name: string) ⇒ object

Description:
Gets a sprite loop by name.

Returns:
object

Parameters:

Name Type Default Description
name string - Name of the sprite loop

getTileset

Signature:
$GG.ui.assets.getTileset(name: string) ⇒ object

Description:
Gets a tileset by name.

Returns:
object

Parameters:

Name Type Default Description
name string - Name of the tileset

getData

Signature:
$GG.ui.assets.getData(name: string) ⇒ object

Description:
Gets data by name.

Returns:
object

Parameters:

Name Type Default Description
name string - Name of the data

📂 audio

Description:
Audio manager endpoints. Learn More


play

Signature:
$GG.ui.audio.play(name: string, loop: boolean, volume: number, clone: boolean) ⇒ object

Description:
Plays an audio asset.

Returns:
object

Parameters:

Name Type Default Description
name string - Name of the audio
loop boolean - Whether to loop the audio or not
volume number - Volume level of the audio
clone boolean - Whether to clone the audio instance or not

stop

Signature:
$GG.ui.audio.stop(nameOrAudio: string||object) ⇒ void

Description:
Stops an audio asset.

Returns:
void

Parameters:

Name Type Default Description
nameOrAudio string||object - Name of the audio or the audio instance

stopAll

Signature:
$GG.ui.audio.stopAll() ⇒ void

Description:
Stops all audio assets.

Returns:
void


fadeOut

Signature:
$GG.ui.audio.fadeOut(name: string, duration: number) ⇒ void

Description:
Fades out an audio asset.

Returns:
void

Parameters:

Name Type Default Description
name string - Name of the audio
duration number - Duration of the fade out in milliseconds

fadeIn

Signature:
$GG.ui.audio.fadeIn(name: string, duration: number, volume: number, startAt: number) ⇒ void

Description:
Fades in an audio asset.

Returns:
void

Parameters:

Name Type Default Description
name string - Name of the audio
duration number - Duration of the fade in
volume number - Final volume level
startAt number - Start time of the audio

📂 input

Description:
Input manager endpoints. Learn More


attach

Signature:
$GG.ui.input.attach(event: string, callback: fn) ⇒ void

Description:
Attaches an event to the user interface.

Returns:
void

Parameters:

Name Type Default Description
event string - Name of the event
callback fn - Callback function for the event

release

Signature:
$GG.ui.input.release(event: string) ⇒ void

Description:
Releases an event from the user interface.

Returns:
void

Parameters:

Name Type Default Description
event string - Name of the event

clear

Signature:
$GG.ui.input.clear() ⇒ void

Description:
Clears all events from the user interface.

Returns:
void


requestMotion

Signature:
$GG.ui.input.requestMotion() ⇒ Promise<string>

Description:
Requests motion events from Mobile Device

Returns:
Promise<string>


requestGeoLocation

Signature:
$GG.ui.input.requestGeoLocation() ⇒ Promise<object>

Description:
Requests geolocation from Mobile Device

Returns:
Promise<object>


📂 visual

Description:
Visual FX manager endpoints. Learn More


📂 type

Description:
Visual FX manager types.


vertex2D

Signature:
$GG.ui.visual.type.vertex2D(x: number, y: number)

Description:
Class representing a 2D vertex.

Parameters:

Name Type Default Description
x number - X coordinate
y number - Y coordinate

orientation2D

Signature:
$GG.ui.visual.type.orientation2D(x: number, y: number, xScale: number, yScale: number, rotation: number)

Description:
Class representing a 2D orientation.

Extends: $GG.ui.visual.type.vertext2D

Parameters:

Name Type Default Description
x number - X coordinate
y number - Y coordinate
xScale number - X scale
yScale number - Y scale
rotation number - Rotation angle

sortBy

Signature:
$GG.ui.visual.type.sortBy

Description:
Enum representing sorting options.


📂 stages

Description:
Stage Types. Learn More


base

Signature:
$GG.ui.visual.type.stages.base(name: string, properties: object)

Description:
Base class for stages.

Parameters:

Name Type Default Description
name string - Name of the stage
properties object - Properties of the stage

portrait

Signature:
$GG.ui.visual.type.stages.portrait(name: string, properties: object)

Description:
Class representing a portrait stage.

Extends: $GG.ui.visual.type.stages.base

Parameters:

Name Type Default Description
name string - Name of the stage
properties object - Properties of the stage

landscape

Signature:
$GG.ui.visual.type.stages.landscape(name: string, properties: object)

Description:
Class representing a landscape stage.

Extends: $GG.ui.visual.type.stages.base

Parameters:

Name Type Default Description
name string - Name of the stage
properties object - Properties of the stage

📂 props

Description:
Stage Prop Types. Learn More


base

Signature:
$GG.ui.visual.type.props.base(properties: object)

Description:
Base class for stage props.

Parameters:

Name Type Default Description
properties object - Properties of the stage prop

sprite

Signature:
$GG.ui.visual.type.props.sprite(properties: object)

Description:
Class representing a sprite prop.

Extends: $GG.ui.visual.type.props.base

Parameters:

Name Type Default Description
properties object - Properties of the sprite prop

tileset

Signature:
$GG.ui.visual.type.props.tileset(layoutName: string, properties: object)

Description:
Class representing a tileset prop.

Extends: $GG.ui.visual.type.props.base

Parameters:

Name Type Default Description
layoutName string - Name of the layout
properties object - Properties of the tileset prop

📂 transitions

Description:
Stage Transitions Types. Learn More


state

Signature:
$GG.ui.visual.type.transitions.state

Description:
Enum representing transition states.


base

Signature:
$GG.ui.visual.type.transitions.base(stageName: string)

Description:
Base class for stage transitions.

Parameters:

Name Type Default Description
stageName string - Name of the stage

none

Signature:
$GG.ui.visual.type.transitions.none()

Description:
No transition stage.

Extends: $GG.ui.visual.type.transitions.base


fade

Signature:
$GG.ui.visual.type.transitions.fade(timeToFade: number)

Description:
Fade transition stage.

Extends: $GG.ui.visual.type.transitions.base

Parameters:

Name Type Default Description
timeToFade number - Time to fade

slide

Signature:
$GG.ui.visual.type.transitions.slide(timeToSlide: number, direction: string)

Description:
Slide transition stage.

Extends: $GG.ui.visual.type.transitions.base

Parameters:

Name Type Default Description
timeToSlide number - Time to slide
direction string - Direction of the slide

zoom

Signature:
$GG.ui.visual.type.transitions.zoom(timeToZoom: number)

Description:
Zoom transition stage.

Extends: $GG.ui.visual.type.transitions.base

Parameters:

Name Type Default Description
timeToZoom number - Time to zoom

flip

Signature:
$GG.ui.visual.type.transitions.flip(timeToFlip: number, direction: string)

Description:
Flip transition stage.

Extends: $GG.ui.visual.type.transitions.base

Parameters:

Name Type Default Description
timeToFlip number - Time to flip
direction string - Direction of the flip

📂 activeStage

Description:
Currently active stage


getHtmlContainer

Signature:
$GG.ui.visual.activeStage.getHtmlContainer() ⇒ HTMLElement

Description:
Gets the HTML container for the active stage.

Returns:
HTMLElement


setState

Signature:
$GG.ui.visual.activeStage.setState(state: object) ⇒ void

Description:
Sets the state of the active stage.

Returns:
void

Parameters:

Name Type Default Description
state object - State object to set

getState

Signature:
$GG.ui.visual.activeStage.getState() ⇒ object

Description:
Gets the state of the active stage.

Returns:
object


getContext

Signature:
$GG.ui.visual.activeStage.getContext() ⇒ CanvasRenderingContext2D

Description:
Gets the drawing context for the active stage.

Returns:
CanvasRenderingContext2D


getThreeBackgroundContext

Signature:
$GG.ui.visual.activeStage.getThreeBackgroundContext() ⇒ WebGLRenderingContext

Description:
Gets the WebGL context for the background of the active stage.

Returns:
WebGLRenderingContext


getSize

Signature:
$GG.ui.visual.activeStage.getSize() ⇒ object

Description:
Gets the size of the active stage.

Returns:
object


getStyle

Signature:
$GG.ui.visual.activeStage.getStyle() ⇒ object

Description:
Gets the style of the active stage.

Returns:
object


publish

Signature:
$GG.ui.visual.activeStage.publish() ⇒ void

Description:
Publishes the active stage.

Returns:
void


setFullScreen

Signature:
$GG.ui.visual.activeStage.setFullScreen() ⇒ void

Description:
Sets the active stage to full screen.

Returns:
void


getThreeRenderer

Signature:
$GG.ui.visual.activeStage.getThreeRenderer() ⇒ WebGLRenderer

Description:
Gets the three.js renderer for the active stage.

Returns:
WebGLRenderer


registerStage

Signature:
$GG.ui.visual.registerStage(name: string, instance: object) ⇒ void

Description:
Registers a stage.

Returns:
void

Parameters:

Name Type Default Description
name string - Name of the stage
instance object - Instance of the stage

destroyStage

Signature:
$GG.ui.visual.destroyStage(stageName: string) ⇒ void

Description:
Destroys a stage.

Returns:
void

Parameters:

Name Type Default Description
stageName string - Name of the stage

setTransition

Signature:
$GG.ui.visual.setTransition(transition: object) ⇒ void

Description:
Sets the transition for stage changes.

Returns:
void

Parameters:

Name Type Default Description
transition object - Transition object

setToStage

Signature:
$GG.ui.visual.setToStage(name: string) ⇒ void

Description:
Sets the active stage to the specified stage.

Returns:
void

Parameters:

Name Type Default Description
name string - Name of the stage

getStage

Signature:
$GG.ui.visual.getStage(name: string) ⇒ object

Description:
Gets the stage by name.

Returns:
object

Parameters:

Name Type Default Description
name string - Name of the stage

getStageName

Signature:
$GG.ui.visual.getStageName() ⇒ string

Description:
Gets the name of the active stage.

Returns:
string


startClock

Signature:
$GG.ui.visual.startClock() ⇒ void

Description:
Starts the stage clock.

Returns:
void


stopClock

Signature:
$GG.ui.visual.stopClock() ⇒ void

Description:
Stops the stage clock.

Returns:
void


setFPS

Signature:
$GG.ui.visual.setFPS(fps: number) ⇒ void

Description:
Sets the frames per second for the stage.

Returns:
void

Parameters:

Name Type Default Description
fps number - Frames per second

📂 hud

Description:
HUD manager endpoints


📂 launcher

Description:
Hud launcher


open

Signature:
$GG.ui.hud.launcher.open(stageName: string, properties: object) ⇒ Promise<StageInstance>

Description:
Opens HUD window and sets to stage.

Returns:
Promise<StageInstance>

Parameters:

Name Type Default Description
stageName string - Name of hudstage to load
properties object "ex

close

Signature:
$GG.ui.hud.launcher.close() ⇒

Description:
Closes hud window


isOpen

Signature:
$GG.ui.hud.launcher.isOpen() ⇒ boolean

Description:
Is HUD window opened?

Returns:
boolean


getStage

Signature:
$GG.ui.hud.launcher.getStage() ⇒ StageInstance

Description:
Gets current hudstage instance.

Returns:
StageInstance


setStage

Signature:
$GG.ui.hud.launcher.setStage(stageName: string) ⇒ StageInstance

Description:
Sets HUD to hudstage.

Returns:
StageInstance

Parameters:

Name Type Default Description
stageName string - Name of stage to load

📂 types

Description:
Hud Types


hudBase

Signature:
$GG.ui.hud.types.hudBase(properties: object)

Description:
Base class for HUD stages.

Extends: $GG.ui.visual.type.stages.base

Parameters:

Name Type Default Description
properties object - Properties of the HUD stage

📂 actions

Description:
Hud Action Types


base

Signature:
$GG.ui.hud.types.actions.base(properties: object)

Description:
Base class for HUD actions.

Extends: $GG.ui.visual.type.props.base

Parameters:

Name Type Default Description
properties object - Properties of the HUD action

state

Signature:
$GG.ui.hud.types.actions.state

Description:
Enum representing HUD action states.


imageAction

Signature:
$GG.ui.hud.types.actions.imageAction(path: string, data: object, duration: number, properties: object)

Description:
Class representing an image action for the HUD.

Extends: $GG.ui.hud.types.base

Parameters:

Name Type Default Description
path string - Path to the image
data object - Image data
duration number - Duration of the action
properties object - Properties of the image action

textAction

Signature:
$GG.ui.hud.types.actions.textAction(text: string, properties: object)

Description:
Class representing a text action for the HUD.

Extends: $GG.ui.hud.types.base

Parameters:

Name Type Default Description
text string - Text content
properties object - Properties of the text action

videoAction

Signature:
$GG.ui.hud.types.actions.videoAction(path: string, properties: object)

Description:
Class representing a video action for the HUD.

Extends: $GG.ui.hud.types.base

Parameters:

Name Type Default Description
path string - Path to the video
properties object - Properties of the video action

initialize

Signature:
$GG.ui.initialize(window: Window, threeSupport: boolean) ⇒ Promise

Description:
Initializes the UI framework.

Parameters:

Name Type Default Description
window Window null Window to use for rendering. Null uses current.
threeSupport boolean - Initializes support for Three.js.

Returns:
Promise


isMobileDevice

Signature:
$GG.ui.isMobileDevice() ⇒ boolean

Description:
Checks if the device is a mobile device.

Returns:
boolean


Globalization API

Including In Html

<head>
    ...
    <script src="https://launch.gig.game/api/js?key={API KEY HERE}&libraries=globalization"></script>
    ...
</head>

language

Signature:
$GG.globalization.language(group: string) ⇒ Promise

Description:
Sets the group for translations and resets the cache. Learn More

Returns:
Promise

Parameters:

Name Type Default Description
group string - The group to set.

setSourceLanguage

Signature:
$GG.globalization.setSourceLanguage(code: string) ⇒ Promise

Description:
Sets the source language code and resets the cache.

Returns:
Promise

Parameters:

Name Type Default Description
code string - The source language code to set.

getLanguages

Signature:
$GG.globalization.getLanguages() ⇒ Promise<object>

Description:
Retrieves the list of available languages.

Returns:
Promise<object>


translate

Signature:
$GG.globalization.translate(text: string, force: boolean) ⇒ Promise<string>

Description:
Translates the given text.

Returns:
Promise<string>

Parameters:

Name Type Default Description
text string - The text to translate.
force boolean false Optional flag to force translation.

translateDom

Signature:
$GG.globalization.translateDom() ⇒ Promise

Description:
Translates the entire DOM based upon autotranslate attributes and translate elements.

Returns:
Promise


clearCache

Signature:
$GG.globalization.clearCache() ⇒ Promise<object>

Description:
Clears the translation cache.

Returns:
Promise<object>


AI / Automation API

Including In Html

<head>
    ...
    <script src="https://launch.gig.game/api/js?key={API KEY HERE}&libraries=ai"></script>
    ...
</head>

getText

Signature:
$GG.ai.getText(prompt: string, temperature: number) ⇒ Promise<response>

Description:
Fetches AI-generated text based on the provided prompt.

Returns:
Promise<response>

Parameters:

Name Type Default Description
prompt string - The input prompt for the AI.
temperature number null Optional temperature for the AI response.

getList

Signature:
$GG.ai.getList(topic: string, limit: number) ⇒ Promise<response>

Description:
Fetches a list of AI-generated items based on the provided topic.

Returns:
Promise<response>

Parameters:

Name Type Default Description
topic string - The topic for which to retrieve AI-generated items.
limit number null Optional limit on the number of items to retrieve.

getImage

Signature:
$GG.ai.getImage(topic: string) ⇒ Promise<response>

Description:
Fetches an AI-generated image based on the provided topic.

Returns:
Promise<response>

Parameters:

Name Type Default Description
topic string - The topic for which to generate an AI image.

moderate

Signature:
$GG.ai.moderate(comment: string) ⇒ Promise<response>

Description:
Fetches AI moderation results for the provided comment.

Returns:
Promise<response>

Parameters:

Name Type Default Description
comment string - The comment to be moderated.

Web Form API

Including In Html

<head>
    ...
    <script src="https://launch.gig.game/api/js?key={API KEY HERE}&libraries=web"></script>
    ...
</head>

handlebarsBoundView Class

Signature:
$GG.web.handlebarsBoundView(target: string, template: string)

Description:
Class extended for binding a web view to a controller class extending handlebars library. Learn More

Parameters:

Name Type Default Description
target string #app Target element id to render too
template string null Path to html view

Code Samples

  1. Rock Paper Scissors - Learn More