-
Notifications
You must be signed in to change notification settings - Fork 1
/
ArcGISJSExample.js
65 lines (59 loc) · 1.54 KB
/
ArcGISJSExample.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
if (Meteor.isClient) {
var routePath = "https://js.arcgis.com/4.0beta1",
routeLoaded = false,
loadHandler = function() {
routeLoaded = true;
};
Router.route('/', {
verbose: true,
name: 'home',
template: 'ArcGIS',
controller: PreloadController,
preload: {
timeOut: 5000,
styles: ['https://js.arcgis.com/4.0beta1/esri/css/esri.css', 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css'],
sync: routePath,
onBeforeSync: function(fileName) {
if (fileName === routePath) {
var script = document.createElement('script');
script.rel = 'preload javascript';
script.type = 'text/javascript';
script.src = routePath;
script.onload = loadHandler;
document.body.appendChild(script);
return false;
}
},
onSync: function(fileName) {
if (routeLoaded && fileName === routePath) {
return !!require && !!define;
}
},
onAfterSync: function(fileName) {
return false;
}
}
});
Template.ArcGIS.rendered = function() {
var map, view;
if (routeLoaded) {
require([
"esri/Map",
"esri/views/SceneView",
"dojo/domReady!"
], function(Map, SceneView) {
map = new Map({
basemap: "streets"
});
view = new SceneView({
container: "viewDiv",
map: map,
scale: 240000000
})
})
}
};
}
if (Meteor.isServer) {
Meteor.startup(function() {});
}