new MapDataRequest()
Class for managing map data requests from the Ingress servers, caching the data, and passing it to the renderer.
Methods
-
static window.MapDataRequest#clearTimeout()
-
Clears the current data refresh timeout.
-
static window.MapDataRequest#delayProcessRequestQueue(seconds)
-
Delays the processing of the request queue for fetching map data tiles. The delay is specified in seconds.
Parameters:
Name Type Description seconds
number The delay in seconds before starting to process the request queue.
-
static window.MapDataRequest#getStatus() → {Object}
-
Gets the current status of the map data request, including short description, long description, and progress.
Returns:
Object -An object containing the current status of the map data request.
-
static window.MapDataRequest#handleResponse(data, tiles, success)
-
Handles the response from the server for tile data requests. Processes success and error cases, manages retries for failed tiles, and updates the render queue with new data.
Parameters:
Name Type Description data
Object The response data from the server.
tiles
Array The array of requested tile identifiers.
success
boolean Flag indicating if the request was successful.
-
static window.MapDataRequest#idleResume()
-
Resumes data fetching and rendering after being idle.
-
static window.MapDataRequest#mapMoveEnd()
-
Handles map movement end. Determines whether new data needs to be fetched based on map bounds and zoom level.
-
static window.MapDataRequest#mapMoveStart()
-
Callback for map movement start. Pauses the rendering and data requests.
-
static window.MapDataRequest#pauseRenderQueue(pause)
-
Pauses or resumes the render queue processing. When paused, the queue timer is cleared.
Parameters:
Name Type Description pause
boolean Flag indicating whether to pause (true) or resume (false) the render queue processing.
-
static window.MapDataRequest#processRenderQueue()
-
Processes the render queue, rendering entities on the map. This function handles both the rendering of new entities and the deletion of old ones. It ensures that the quantity of entities processed per cycle does not exceed a set limit.
-
static window.MapDataRequest#processRequestQueue()
-
Processes the request queue for fetching map data tiles. Manages the number of simultaneous tile requests, tile error handling, and updates the request status.
-
static window.MapDataRequest#pushRenderQueue(id, data, status)
-
Pushes a tile to the render queue for processing. The queue is processed to render entities on the map.
Parameters:
Name Type Description id
string The identifier of the tile.
data
Object Data associated with the tile, including game entity GUIDs and entities.
status
string The status of the tile, such as 'render-queue'.
-
static window.MapDataRequest#refresh()
-
Initiates the map data refresh process. This includes resetting necessary properties, preparing requests for map data, and handling cached data.
-
static window.MapDataRequest#refreshOnTimeout(seconds)
-
Sets a timeout to refresh the map data.
Parameters:
Name Type Description seconds
number Time in seconds to wait before refreshing the map data.
-
static window.MapDataRequest#requeueTile(id, error)
-
Re-queues a tile for data fetching in case of an error or timeouts. Handles retry limits and uses stale data if available.
Parameters:
Name Type Description id
string The tile identifier.
error
boolean Flag indicating whether the tile fetch encountered an error.
-
static window.MapDataRequest#resetRenderQueue()
-
Resets the render queue, clearing existing queued render tasks and stopping any active timer.
-
static window.MapDataRequest#sendTileRequest(tiles)
-
Sends requests for a group of tiles to the server. Updates the debugTiles state and manages the count of active requests.
Parameters:
Name Type Description tiles
Array An array of tile identifiers to request.
-
static window.MapDataRequest#setStatus(short, longopt, progressopt)
-
Sets the current status of the map data request, including a short description, long description, and progress.
Parameters:
Name Type Attributes Description short
string Short description of the current status.
long
string <optional>
Long description of the current status.
progress
number <optional>
Progress indicator, typically represented as a percentage.
-
static window.MapDataRequest#start()
-
Starts the data request process, setting up hooks and callbacks.
-
static window.MapDataRequest#startQueueTimer(delay)
-
Starts a timer to process the render queue after a specified delay.
Parameters:
Name Type Description delay
number The delay in seconds before processing the render queue.