new PFCommodity(id, startLat, startLong, endLat, endLong, status, capacity, pathfinder)
Pathfinder commodity constructor. Do not call this constructor it is for the Pathfinder object to use.
Parameters:
Name | Type | Description |
---|---|---|
id |
number | Id of the commodity |
startLat |
number | The starting latitude of the commodity |
startLong |
number | The starting longitude of the commodity |
endLat |
number | The ending latitude of the commodity |
endLong |
number | The ending longitude of the commodity |
status |
string | The status of the commodity |
capacity |
number | The capacity of the commodity |
pathfinder |
Pathfinder | Pathfinder object that creates this commodity |
- Source:
Methods
-
routeSubscribe(onSubscribeCallback, updateCallback)
-
Subscribe for route updates to the commodity.
Parameters:
Name Type Description onSubscribeCallback
PFCommodity~routeOnSubscribeCallback The callback used when the route subscribe request is successful updateCallback
PFCommodity~routeUpdateCallback The callback used when the commodity's route is updated - Source:
-
routeUnsubscribe()
-
Unsubscribes the commodity to route updates.
- Source:
-
subscribe(onSubscribeCallback, updateCallback)
-
Subscribe for updates to the commodity.
Parameters:
Name Type Description onSubscribeCallback
PFCommodity~subscribeOnSubscribeCallback The callback used when the subscribe request is successful updateCallback
PFCommodity~subscribeUpdateCallback The callback used when updates to the commodity are received - Source:
-
unsubscribe()
-
Unsubscribes the commodity 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 commodity's route subscribed to - Source:
-
routeUpdateCallback(commodity, route)
-
This callback is called when the route subscribe function receives an receives update response.
Parameters:
Name Type Description commodity
PFCommodity The commodity subscribed to route
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 commodity subscribed to - Source:
-
subscribeUpdateCallback(commodity, updatedCommodity)
-
This callback is called when the subscribe function receives an receives update response.
Parameters:
Name Type Description commodity
PFCommodity The commodity subscribed to updatedCommodity
PFCommodity The updated commodity received - Source: