派生自 wuyushui/SewerAndRainNetwork

ChenZeping
2021-05-08 4879421ff17a679a838de208125617d2eaa351a2
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
 
class EventHandler {
  constructor () {
    this.map = window.map
    this.mapClickForLayers = {}
 
    window.map.on('click', (e) => {
      for (var k in this.mapClickForLayers) {
        const func = this.mapClickForLayers[k]
        console.log(func)
        func(e)
      }
    })
  }
 
  addLayerEvent (config, callback) {
    this.mapClickForLayers[config.code] = callback
  }
 
  removeEvent (config) {
    delete this.mapClickForLayers[config.code]
  }
}
 
export default EventHandler