- function MapPool(){
- function createMarker(name, lat, lng, state){
- var marker = new AMap.Marker({
- position : new AMap.LngLat(lng, lat),
- });
- //the function mapMoveTo is not accessible here too
- AMap.event.addListener(marker, "click",function(e){
- //moveMapTo(key, name, state)
- //or this.moveMapTo(key, name, state) will raise a unresolved function error
- //you should write wrapper function as a member variable
- _mapMoveTo(key, name, state);
- });
- }
- var _mapMoveTo = function(key, name, state){
- //TODO
- }
- this.mapMoveTo = function(key, name, state) {
- _mapMoveTo(key, name, state);
- }
- }
- //该片段来自于http://www.codesnippet.cn/detail/1908201410231.html
来源: http://www.codesnippet.cn/detail/1908201410231.html