[OpenLayers-Users] Offline Storage Help

ANC anajera at bicimapas.com.mx
Thu Jan 16 15:33:48 PST 2014


Sorry for how the code looks in the prevous message, it was no like that when
I pasted it. Here is the relevant code for the cacheWrite and cacheRead
function calls,  copied from their respective examples but in a single file:

      cacheRead = new OpenLayers.Control.CacheRead({
        autoActivate: false,
        fetchEvent: "tileloadstart" 
    });
    map.addControl(cacheRead);
 
 cacheWrite = new OpenLayers.Control.CacheWrite({
        autoActivate: true,
        imageFormat: "image/jpeg",
        eventListeners: {
            cachefull: function() { status.innerHTML = "Cache full."; }
        }
    });
    map.addControl(cacheWrite);               
	
	// User interface
    var status = document.getElementById("status");
    document.getElementById("clear").onclick = function() {
        OpenLayers.Control.CacheWrite.clearCache();
        updateStatus();
    };

    // update the number of cached tiles and detect local storage support
    map.layers[0].events.on({'tileloaded': updateStatus});
    function updateStatus() {
        if (window.localStorage) {
            status.innerHTML = localStorage.length + " entries in cache.";
        } else {
            status.innerHTML = "Local storage not supported. Try a different
browser.";
        }
    }

}


thanks



--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Offline-Storage-Help-tp5096401p5098516.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list