diff --git a/lib/tiles/offlineEnabler.js b/lib/tiles/offlineEnabler.js index 83f7ba4..6d99f99 100644 --- a/lib/tiles/offlineEnabler.js +++ b/lib/tiles/offlineEnabler.js @@ -224,7 +224,10 @@ define([ layer.loadFromFile = function(file, callback) // callback(success,msg) { + console.log("reading",file); + var store = this.offline.store; + var layer = this; if (window.File && window.FileReader && window.FileList && window.Blob) { @@ -246,16 +249,23 @@ define([ url: pair[0], img: pair[1] } + console.log("read",tile.url); store.add(tile,function(success) { + console.log("."); + if( success ) tileCount += 1; if( tileCount == tiles.length-1) + { + console.log("finished!"); + window.setTimeout(function() { /* refresh layer by zooming in and out, or some way that really refreshes the layer */ }, 1000); callback(true, tileCount + " tiles loaded from " + file.name); + } }); } - } + }; reader.readAsText(file); } else diff --git a/samples/tiles/tiles-indexed-db.html b/samples/tiles/tiles-indexed-db.html index 2bd1e72..a4f8eed 100644 --- a/samples/tiles/tiles-indexed-db.html +++ b/samples/tiles/tiles-indexed-db.html @@ -35,7 +35,7 @@ - JS Offline Mapping + JS Offline Mapping esri - - + +