Hi simo xu,
Maybe this is what you are looking for:
map.basemap = "satellite";
See example below where the basemap changes, depending on the scale of the view.
What do you think?
Cheers,
Egge-Jan
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no" />
<title>Watching property changes</title>
<style>
html,
body,
#viewDiv {
padding: 0;
margin: 0;
height: 100%;
width: 100%;
}
</style>
<link rel="stylesheet" href="https://js.arcgis.com/4.11/esri/css/main.css" />
<script src="https://js.arcgis.com/4.11/"></script>
<script>
require(["esri/WebMap", "esri/views/MapView"], function(WebMap, MapView) {
var map = new WebMap({
basemap: "satellite"
});
var view = new MapView({
container: "viewDiv",
map: map,
zoom: 4,
center: [15, 65]
});
var handle = view.watch('scale', function(newScale) {
console.log("Scale: ", newScale);
console.log("Basemap: ", map.basemap.title);
if (newScale > 10000000) {
map.basemap = "satellite";
} else {
map.basemap = "streets";
}
});
});
</script>
</head>
<body>
<div id="viewDiv"></div>
</body>
</html>