sync-system

sync. sync-system

Connect to a remote Firebase server, and facilitate synchronization. These options correspond exactly with the configuration options for altspace.utilities.sync.connect. This component must be present on a-scene for any other sync components to work.

Properties:
Name Type Description
author string

A unique identifier for you or your organization.

app string

The name of the app.

refUrl string

Override the base reference. Set this to use your own Firebase.

instance string

Override the instance ID. Can also be overridden with a URL parameter.

Members

(readonly) isConnected

True if the sync system is connected and ready for syncing.

(readonly) isMasterClient

True if this client is currently the master client.

Methods

instantiate(mixin, parentopt, elopt, groupNameopt, instantiatorIdopt)

Instantiate an entity with the given mixins.

Parameters:
Name Type Attributes Description
mixin string

A comma-separated list of mixin ids which should be used to instantiate the entity.

parent Element <optional>

An element to which the entity should be added. Defaults to the scene.

el Element <optional>

The element responsible for instantiating this entity.

groupName string <optional>

A group that the entity should belong to. Used in conjunction with removeLast.

instantiatorId string <optional>

Used by removeLast to indicate who was responsible for the removed entity.

removeLast(groupName) → {Promise}

Remove the last entity instantiated in the given group. Returns a Promise which resolves with the instantiatorId associated with the removed entity.

Parameters:
Name Type Description
groupName string

Name of the group from which to remove the entity.

Events

clientjoined

Fired when a client joins.

Properties:
Name Type Description
id string

Guid identifying the client.

clientleft

Fired when a client leaves.

Properties:
Name Type Description
id string

Guid identifying the client.

connected

Fired when a connection is established and the sync system is fully initialized.

Properties:
Name Type Description
shouldInitialize boolean

True if this is the first client to establish a connection.