Class: Snapshot

Grape2D. Snapshot

new Snapshot(time, events, networkObjects)

Snapshot class.
Parameters:
Name Type Argument Description
time number Time of the snapshot.
events !Array.<!Grape2D.SnapshotEvent>= <optional>
List of events in the snapshots.
networkObjects !Object.<!(number|string), !Grape2D.SnapshotNetworkObject2D>= <optional>
List of objects in the snapshot.
Source:

Members

<private> events :!Array.<!Grape2D.SnapshotEvent>

Snapshot events.
Type:
Source:

<private> networkObjects :!Object.<!(number|string), !Grape2D.SnapshotNetworkObject2D>

Snapshot objects.
Type:
Source:

<private> time :number

Snapshot time.
Type:
  • number
Source:

Methods

addEvent(event)

Adds an event to the snapshot.
Parameters:
Name Type Description
event Grape2D.SnapshotEvent Snapshot event.
Source:

addSnapshotNetworkObject2D(sno2d)

Adds an object to the snapshot.
Parameters:
Name Type Description
sno2d Grape2D.SnapshotNetworkObject2D Snapshot object.
Source:

dispatch(eventsParam, objsParam)

Dispatches the tasks of this snapshot, by firing the events and updating Grape2D.NetworkObject2Ds.
Parameters:
Name Type Argument Description
eventsParam Object <optional>
Arbitrary object. To be passed to Grape2D.Snapshot.fireEvents.
objsParam Object <optional>
Arbitrary object. To be passed to Grape2D.Snapshot.fireEvents.
Source:

fireEvents(param)

Fires the events.
Parameters:
Name Type Argument Description
param Object <optional>
An arbitrary object to be passed. Since events can be used widely an object with the necessary information may be passed.
Source:

getEvents() → {!Array.<!Grape2D.SnapshotEvent>}

Gets the snapshot events.
Source:
Returns:
Snapshot events.
Type
!Array.<!Grape2D.SnapshotEvent>

getSnapshotNetworkObject2D(id) → {Grape2D.SnapshotNetworkObject2D|undefined}

Gets an object
Parameters:
Name Type Description
id number | string Object's id.
Source:
Returns:
Object.
Type
Grape2D.SnapshotNetworkObject2D | undefined

getTime() → {number}

Gets the snapshot time.
Source:
Returns:
Time.
Type
number

updateNetworkObject2D(param)

Updates the Grape2D.NetworkObject2Ds of this snapshot.
Parameters:
Name Type Argument Description
param Object <optional>
An arbitrary object to be passed.
Source: