@yuneta/gobj-js 7.3.1 → 7.3.4

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.
@@ -512,7 +512,8 @@ function json2item(gobj, sdata, it, jn_value_) {
512
512
  let jn_value2;
513
513
  switch (it.type) {
514
514
  case data_type_t.DTP_STRING:
515
- if (is_string(jn_value_)) jn_value2 = String(jn_value_);
515
+ if (jn_value_ === null || jn_value_ === void 0) jn_value2 = "";
516
+ else if (is_string(jn_value_)) jn_value2 = String(jn_value_);
516
517
  else {
517
518
  let s = JSON.stringify(jn_value_);
518
519
  if (s) jn_value2 = String(s);
@@ -4389,8 +4390,10 @@ function createElement2(description, translate_fn) {
4389
4390
  el.style.cssText = styleString;
4390
4391
  } else if (attr === "style") el.style.cssText = attrs[attr];
4391
4392
  else if (attr === "i18n" || attr === "data-i18n" || attr === "data_i18next" || attr === "data-i18next") {
4392
- data_i18next = attrs[attr];
4393
- el.setAttribute("data-i18n", data_i18next);
4393
+ if (attrs[attr] !== null && attrs[attr] !== void 0) {
4394
+ data_i18next = attrs[attr];
4395
+ el.setAttribute("data-i18n", data_i18next);
4396
+ }
4394
4397
  } else el.setAttribute(attr, attrs[attr]);
4395
4398
  if (is_string(content)) {
4396
4399
  content = content.trim();
@@ -4463,6 +4466,14 @@ function refresh_language(element, t) {
4463
4466
  break;
4464
4467
  }
4465
4468
  });
4469
+ element.querySelectorAll("[data-i18n-title]").forEach(function(elem) {
4470
+ let value = elem.getAttribute("data-i18n-title");
4471
+ if (value) elem.setAttribute("title", t(value));
4472
+ });
4473
+ element.querySelectorAll("[data-i18n-aria-label]").forEach(function(elem) {
4474
+ let value = elem.getAttribute("data-i18n-aria-label");
4475
+ if (value) elem.setAttribute("aria-label", t(value));
4476
+ });
4466
4477
  }
4467
4478
  /************************************************************
4468
4479
  * Example Usage
@@ -5843,6 +5854,17 @@ function ac_on_close(gobj, event, kw, src) {
5843
5854
  remote_yuno_role: priv.remote_yuno_role,
5844
5855
  remote_yuno_service: priv.remote_yuno_service
5845
5856
  });
5857
+ } else {
5858
+ log_warning(`${gobj_short_name(gobj)}: EV_ON_OPEN_ERROR cannot open ${url} (Code: ${e.code}, Reason: "${e.reason}", Clean: ${e.wasClean})`);
5859
+ gobj_publish_event(gobj, "EV_ON_OPEN_ERROR", {
5860
+ url,
5861
+ remote_yuno_name: priv.remote_yuno_name,
5862
+ remote_yuno_role: priv.remote_yuno_role,
5863
+ remote_yuno_service: priv.remote_yuno_service,
5864
+ code: e.code,
5865
+ reason: e.reason,
5866
+ was_clean: e.wasClean
5867
+ });
5846
5868
  }
5847
5869
  if (gobj_is_running(gobj)) set_timeout(priv.gobj_timer, gobj_read_integer_attr(gobj, "timeout_retry"));
5848
5870
  return 0;
@@ -6073,6 +6095,7 @@ function create_gclass(gclass_name) {
6073
6095
  ["EV_MT_COMMAND", event_flag_t.EVF_PUBLIC_EVENT],
6074
6096
  ["EV_ON_OPEN", event_flag_t.EVF_OUTPUT_EVENT | event_flag_t.EVF_NO_WARN_SUBS],
6075
6097
  ["EV_ON_CLOSE", event_flag_t.EVF_OUTPUT_EVENT | event_flag_t.EVF_NO_WARN_SUBS],
6098
+ ["EV_ON_OPEN_ERROR", event_flag_t.EVF_OUTPUT_EVENT | event_flag_t.EVF_NO_WARN_SUBS],
6076
6099
  ["EV_TIMEOUT", 0],
6077
6100
  [null, 0]
6078
6101
  ], states, gmt, 0, attrs_table, PRIVATE_DATA, 0, 0, 0, gclass_flag_t.gcflag_no_check_output_events);