ALKMaps.Control.CacheRead

A control for using image tiles cached with ALKMaps.Control.CacheWrite from the browser’s local storage.

Inherits from

Summary
ALKMaps.Control.CacheReadA control for using image tiles cached with ALKMaps.Control.CacheWrite from the browser’s local storage.
Properties
fetchEvent{String} The layer event to listen to for replacing remote resource tile URLs with cached data URIs.
layers{Array(ALKMaps.Layer.Grid)}.
autoActivate{Boolean} Activate the control when it is added to a map.
Constructor
ALKMaps.Control.CacheRead
Functions
setMapSet the map property for the control.
addLayerAdds a layer to the control.
removeLayerRemoves a layer from the control.
fetchListener to the fetchEvent event.
destroyThe destroy method is used to perform any clean up before the control is dereferenced.

Properties

fetchEvent

{String} The layer event to listen to for replacing remote resource tile URLs with cached data URIs.  Supported values are “tileerror” (try remote first, fall back to cached) and “tileloadstart” (try cache first, fall back to remote).  Default is “tileloadstart”.

Note that “tileerror” will not work for CORS enabled images ALKMaps.Tile.Image.crossOriginKeyword in ALKMaps.Layer.Grid.tileOptions.

layers

{Array(ALKMaps.Layer.Grid)}.  Optional.  If provided, only these layers will receive tiles from the cache.

autoActivate

{Boolean} Activate the control when it is added to a map.  Default is true.

Constructor

ALKMaps.Control.CacheRead

Parameters

options{Object} Object with API properties for this control

Functions

setMap

setMap: function(map)

Set the map property for the control.

Parameters

map{ALKMaps.Map}

addLayer

addLayer: function(evt)

Adds a layer to the control.  Once added, tiles requested for this layer will be cached.

Parameters

evt{Object} Object with a layer property referencing an ALKMaps.Layer instance

removeLayer

removeLayer: function(evt)

Removes a layer from the control.  Once removed, tiles requested for this layer will no longer be cached.

Parameters

evt{Object} Object with a layer property referencing an ALKMaps.Layer instance

fetch

fetch: function(evt)

Listener to the fetchEvent event.  Replaces a tile’s url with a data URI from the cache.

Parameters

evt{Object} Event object with a tile property.

destroy

destroy: function()

The destroy method is used to perform any clean up before the control is dereferenced.  Typically this is where event listeners are removed to prevent memory leaks.

A control for caching image tiles in the browser’s local storage.
Base class for layers that use a lattice of tiles.
setMap: function(map)
Set the map property for the control.
addLayer: function(evt)
Adds a layer to the control.
removeLayer: function(evt)
Removes a layer from the control.
fetch: function(evt)
Listener to the fetchEvent event.
{String} The layer event to listen to for replacing remote resource tile URLs with cached data URIs.
destroy: function()
The destroy method is used to perform any clean up before the control is dereferenced.
Controls affect the display or behavior of the map.
The value of the crossorigin keyword to use when loading images.
{Object} optional configuration options for ALKMaps.Tile instances created by this Layer, if supported by the tile class.
Instances of ALKMaps.Map are interactive maps embedded in a web page.
Close