Skip to content

Instantly share code, notes, and snippets.

@andygup
Last active December 1, 2017 22:12
Show Gist options
  • Select an option

  • Save andygup/eefbfb8b6961039fb484b579759ff851 to your computer and use it in GitHub Desktop.

Select an option

Save andygup/eefbfb8b6961039fb484b579759ff851 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html manifest="https://rawgit.com/andygup/a1dd6f3228d44d86c466051420ba9166/raw/50f2288334122e3fdf3c176c96fec7f21ee9450a/appcache-test.appcache">
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no">
<title>FeatureLayer - 4.5</title>
<link rel="stylesheet" href="https://js.arcgis.com/4.5/esri/css/main.css">
<script src="https://js.arcgis.com/4.5/"></script>
<style>
html,
body,
#viewDiv {
padding: 0;
margin: 0;
height: 100%;
width: 100%;
}
</style>
<script>
function onUpdateReady() {
alert('found new version!');
console.log("Appcache has been updated. Running swapCache()")
window.applicationCache.swapCache()
}
window.applicationCache.addEventListener('updateready', onUpdateReady);
if(window.applicationCache.status === window.applicationCache.UPDATEREADY) {
onUpdateReady();
}
require([
"esri/Map",
"esri/views/MapView",
"esri/layers/FeatureLayer",
"dojo/domReady!"
],
function(
Map, MapView,
FeatureLayer
) {
var map = new Map({
basemap: "hybrid"
});
var view = new MapView({
container: "viewDiv",
map: map,
extent: { // autocasts as new Extent()
xmin: -9177811,
ymin: 4247000,
xmax: -9176791,
ymax: 4247784,
spatialReference: 102100
}
});
/********************
* Add feature layer
********************/
// Carbon storage of trees in Warren Wilson College.
var featureLayer = new FeatureLayer({
url: "https://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/Landscape_Trees/FeatureServer/0"
});
map.add(featureLayer);
});
</script>
</head>
<body>
<div id="viewDiv"></div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment