Class: PFCluster

PFCluster

new PFCluster(id, parentId, commodities, transports, pathfinder)

Pathfinder cluster constructor. Do not call this constructor it is for the Pathfinder object to use.
Parameters:
Name Type Description
id number The id of the cluster
parentId number The parent id of the cluster
commodities array Array of the commodities in the cluster
transports array Array of the transports in the cluster
pathfinder Pathfinder Pathfinder object that creates this commodity
Source:

Methods

routeSubscribe(onSubscribeCallback, updateCallback)

Subscribe for route updates to the cluster.
Parameters:
Name Type Description
onSubscribeCallback PFCluster~routeOnSubscribeCallback The callback used when the route subscribe request is successful
updateCallback PFCluster~routeUpdateCallback The callback used when the cluster's routes are updated
Source:

routeUnsubscribe()

Unsubscribes the cluster to route updates.
Source:

subscribe(onSubscribeCallback, updateCallback)

Subscribe for updates to the cluster.
Parameters:
Name Type Description
onSubscribeCallback PFCluster~subscribeOnSubscribeCallback The callback used when the subscribe request is successful
updateCallback PFCluster~subscribeUpdateCallback The callback used when updates to the cluster are received
Source:

unsubscribe()

Unsubscribes the cluster to updates.
Source:

Type Definitions

routeOnSubscribeCallback(id)

This callback is called after the route subscribe function receives a response.
Parameters:
Name Type Description
id number Id of the cluster's routes subscribed to
Source:

routeUpdateCallback(cluster, routes)

This callback is called when the route subscribe function receives an receives update response.
Parameters:
Name Type Description
cluster PFCluster The cluster subscribed to
routes object The updated route information
Source:

subscribeOnSubscribeCallback(id)

This callback is called after the subscribe function receives a response.
Parameters:
Name Type Description
id number Id of the cluster subscribed to
Source:

subscribeUpdateCallback(cluster, updatedCluster)

This callback is called when the subscribe function receives an receives update response.
Parameters:
Name Type Description
cluster PFCluster The cluster subscribed to
updatedCluster PFCluster The updated cluster received
Source: