-
Notifications
You must be signed in to change notification settings - Fork 3
API Reference
Stefan Dühring edited this page Jun 9, 2013
·
1 revision
pg.noConflict : fn - reset namespace
pg.VERSION : obj - refers to the current version
pg.info : obj - information about the state
pg.config : fn - configuration for the network
pg.login : fn - set identifier and create player
pg.player : obj - own user instance (writeable)
pg.peers : obj - list of connected players (readable)
pg.data : arr - shortcut to access peers.data + player.data
pg.sync : obj - synchronized shared object
pg.loop : fn - synchronized rendering process
pg.channel : fn - handler for a "Channel"
pg.game : fn - handler for a "Game"
pg.routes : fn - define default and custom routes
- pg
Retrieving the old value of the namespace pg.
// Example
pg.noConflict();Shows information about the current version.
{
codeName - {String} - projectname of the release
full - {String} -
major - {Number} -
minor - {Number} -
dot - {Number} -
}
Contains various information about the current state & network.
{
route - {String} - current route of the player
}
Changes the configuration with custom settings.
-
customConfig- {Object}:
Creates a new instance of player (enables pg.player) and
Defines custom routes to match the parameters in the URL. If just one paremeter is provided, it will use as the new defaultRoute.
The user model contains information about the account, the position and data.
{
account - {Object} -
data - {Object} -
pos - {Number} -
id - {String} -
}
Events:
Read/Write access. Your instance, which will be synced as a peer on other systems.
Read access. Data from other player which will updated as their remote origin changes.
Events: