Global

Methods

module:app(environment, startedCallback) → {module:app}

Starts the application and returns it.

Please note that this module is designed to be a singleton. Any subsequent loading (require("app")) will return the already started application if any.

If environment.debug === true it doesn't create any workers, thus a single process. Otherwise, it creates a worker for each CPU.

Dead workers will be replaced with new ones.

Please note that startedCallback is called for each worker.

Parameters:
Name Type Description
environment module:environment

environment to use

startedCallback function

callback to call once application is started. Receives the app instance.

Source:
Returns:

the app that is created

Type
module:app

module:services/optionDataLoader(optionGroups, imageDirectory, imageExtension) → {Object}

Creates the loader using the passed configuration.

Parameters:
Name Type Description
optionGroups Array.<OptionGroup>

All option groups

imageDirectory string

Image directory to find resources for options

imageExtension string

Image filename extension for option resources

Source:
Throws:

when there is a problem with passed parameters

Type
Error
Returns:
Type
Object

module:services/userManager()

Creates a new user manager.

Source:
Throws:

when there is a problem with passed parameters

Type
Error

Type Definitions

ColorImageMap

Type:
  • Object.<string, Buffer>
Source:

FacebookUserData

A composition of user Facebook profile data and Facebook token data.

Type:
  • Object
Properties:
Name Type Description
facebookUserId number

Facebook user id of the user

longLivedToken string

Facebook long lived token to access user information later

longLivedTokenExpire number

Expire time of the Facebook long lived token

data object

Fetched Facebook profile data

Source:

Option

Represents a character customization option.

Type:
  • Object
Properties:
Name Type Attributes Description
id number

Id of the option

groupId number

Group id of the option

name string

Name of the option

resource string

Image base file name of the option (without extension)

thumbColor string <optional>

Color to use in thumbnails. This is reserved for future.

colors Array.<string> <optional>

Colors that this option supports. Optional.

Source:
Example
<pre>
    {
        "name": "Anime",
        "resource": "eye_anime",
        "colors": [
          "#000000",
          "#FF0000",
          "#FFFFFF"
        ],
        "thumbColor": "#000000",
        "id": 2001,
        "groupId": 2
      }
</pre>

OptionGroup

Represents a character customization option group.

Type:
  • Object
Properties:
Name Type Description
id number

Id of the group

name string

Name of the group

allowMax number

Max N items are allowed from this group to have in the character customization

forceSelect boolean

Character customization must have an option from this group

zIndex number

Z-index of the group options. See module:constants.animationLayer_Z_Index

options Array.<Option>

Options of the group

Source:
Example
<pre>
{
    "id": 1,
    "name": "Skin",
    "allowMax": 1,
    "forceSelect": true,
    "zIndex": 100,
    "options": [
      {
        "name": "Skin",
        "resource": "skin",
        "colors": [
          "#27160E",
          "#935837"
        ],
        "id": 1000,
        "groupId": 1
      }
    ]
  }
 </pre>

OptionImageMapValueItem

Type:
Source:

UserCharPart

Type:
  • Object
Properties:
Name Type Description
optionId number

id of the option

color string | undefined

color of the option. not set at all if option doesn't have colors but this option is in selection.

Source:
Examples
// no colors defined for option
{"optionId":1001}
// colors are defined for option and a color is selected
{"optionId":1001, color":"#FF00FF"}