@yuneta/gobj-js 7.3.4 → 7.6.6

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.
@@ -1762,8 +1762,12 @@ function gobj_read_attrs(gobj, include_flag, src) {
1762
1762
  const it = sdata_desc[i];
1763
1763
  if (!it.name) continue;
1764
1764
  if (include_flag === -1 || it.flag & include_flag) {
1765
- let jn = json_object_get(gobj.jn_attrs, it.name);
1766
- json_object_set(jn_attrs, it.name, jn);
1765
+ let value;
1766
+ if (gobj.gclass.gmt.mt_reading && !(gobj.obflag & obflag_t.obflag_destroyed)) {
1767
+ value = gobj.gclass.gmt.mt_reading(gobj, it.name);
1768
+ if (value === void 0) value = json_object_get(gobj.jn_attrs, it.name);
1769
+ } else value = json_object_get(gobj.jn_attrs, it.name);
1770
+ json_object_set(jn_attrs, it.name, value);
1767
1771
  }
1768
1772
  }
1769
1773
  return jn_attrs;
@@ -1994,9 +1998,9 @@ function gobj_change_state(gobj, state_name) {
1994
1998
  *
1995
1999
  ***************************************************************************/
1996
2000
  function gobj_current_state(gobj) {
1997
- if (gobj_is_destroying(gobj)) {
1998
- log_error("gobj NULL or DESTROYED");
1999
- return null;
2001
+ if (!is_gobj(gobj)) {
2002
+ log_error("hgobj NULL");
2003
+ return "";
2000
2004
  }
2001
2005
  return gobj.current_state.state_name;
2002
2006
  }
@@ -5476,7 +5480,13 @@ function mt_stop(gobj) {
5476
5480
  let priv = gobj.priv;
5477
5481
  clear_timeout(priv.gobj_timer);
5478
5482
  gobj_stop(priv.gobj_timer);
5479
- if (priv.websocket) close_websocket(gobj);
5483
+ if (priv.websocket) {
5484
+ priv.websocket.onopen = null;
5485
+ priv.websocket.onmessage = null;
5486
+ priv.websocket.onerror = null;
5487
+ priv.websocket.onclose = null;
5488
+ close_websocket(gobj);
5489
+ }
5480
5490
  return 0;
5481
5491
  }
5482
5492
  /***************************************************************