Created
October 11, 2020 11:43
-
-
Save zhongyangxun/3d254adeb85dba247b33550780c0c2fb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const baiduMap = { | |
show() { | |
console.log('开始渲染百度地图。') | |
} | |
} | |
const renderMap = (map) => { | |
map.show() | |
} | |
const googleMap = { | |
display() { | |
console.log('开始渲染谷歌地图。') | |
} | |
} | |
const googleMapAdapter = { | |
show() { | |
googleMap.display() | |
} | |
} | |
renderMap(baiduMap) | |
renderMap(googleMapAdapter) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment