@ohuoy/easymap 1.1.3 → 1.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -43,6 +43,7 @@ export class EasyMap {
43
43
  'features':[]
44
44
  }
45
45
  labelLayer = null;
46
+ themeEvent = null
46
47
 
47
48
 
48
49
  constructor(target,styleUrl,config) {
@@ -93,7 +94,7 @@ export class EasyMap {
93
94
  // this.map.currentTheme = new Proxy(_currentTheme,)
94
95
  this.target = map.target;
95
96
  let that = this;
96
- this.map.theme = observe({value:""})
97
+ this.map.theme = observe({value:""},themeEvent)
97
98
  this.map.on('load',()=>{
98
99
  this.map.theme.value = this.map.style.stylesheet.theme
99
100
  // console.log(this.map)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ohuoy/easymap",
3
- "version": "1.1.3",
3
+ "version": "1.1.5",
4
4
  "description": "self map easy use",
5
5
  "main": "main.js",
6
6
  "scripts": {
@@ -40,7 +40,7 @@ function update(target, key) {
40
40
  deps.forEach((dep) => dep());
41
41
  }
42
42
 
43
- export function observe(obj){
43
+ export function observe(obj,eventFun){
44
44
  if (typeof obj !== "object") {
45
45
  return obj;
46
46
  }
@@ -58,6 +58,9 @@ export function observe(obj){
58
58
  const res = Reflect.set(target, key, val, receiver);
59
59
  // 侦听到数据变化,执行相应回调
60
60
  update(target, key);
61
+ if(eventFun){
62
+ eventFun(target,key, val, receiver)
63
+ }
61
64
  return res;
62
65
  }
63
66
  })