mirror of
https://github.com/Esri/offline-editor-js.git
synced 2025-12-15 15:20:05 +00:00
online/offline detection working
This commit is contained in:
parent
71219a28b4
commit
93233f255e
@ -60,7 +60,19 @@
|
||||
}
|
||||
</style>
|
||||
|
||||
<script src="../vendor/offline/offline.min.js"></script>
|
||||
<script>
|
||||
Offline.options = {
|
||||
checks: {
|
||||
image: {
|
||||
url: function() {
|
||||
return 'http://esri.github.io/offline-editor-js/tiny-image.png?_=' + (Math.floor(Math.random() * 1000000000));
|
||||
}
|
||||
},
|
||||
active: 'image'
|
||||
}
|
||||
}
|
||||
|
||||
var locationPath = location.pathname.replace(/\/[^/]+$/, "");
|
||||
var dojoConfig = {
|
||||
paths: {
|
||||
@ -132,6 +144,13 @@
|
||||
})
|
||||
|
||||
function startMap(){
|
||||
|
||||
//Make sure map shows up after a browser refresh
|
||||
Offline.check();
|
||||
Offline.on('up', goOnline);
|
||||
Offline.on('down', goOffline);
|
||||
Offline.state === 'up' ? zoom = 18 : zoom = 17;
|
||||
|
||||
tileLayer = new OfflineTilesEnabler("http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer",function(evt){
|
||||
console.log("Tile Layer Loaded.");
|
||||
},true);
|
||||
@ -240,6 +259,14 @@
|
||||
* ************************************
|
||||
*/
|
||||
|
||||
function goOnline(){
|
||||
console.log("Online");
|
||||
}
|
||||
|
||||
function goOffline(){
|
||||
console.log("Offline");
|
||||
}
|
||||
|
||||
/**
|
||||
* For internal use - detecting amount of storage used and number of tiles stored.
|
||||
*/
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user