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