@yuneta/gobj-js 7.3.1 → 7.3.3

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.
@@ -516,7 +516,8 @@
516
516
  let jn_value2;
517
517
  switch (it.type) {
518
518
  case data_type_t.DTP_STRING:
519
- if (is_string(jn_value_)) jn_value2 = String(jn_value_);
519
+ if (jn_value_ === null || jn_value_ === void 0) jn_value2 = "";
520
+ else if (is_string(jn_value_)) jn_value2 = String(jn_value_);
520
521
  else {
521
522
  let s = JSON.stringify(jn_value_);
522
523
  if (s) jn_value2 = String(s);
@@ -4393,8 +4394,10 @@
4393
4394
  el.style.cssText = styleString;
4394
4395
  } else if (attr === "style") el.style.cssText = attrs[attr];
4395
4396
  else if (attr === "i18n" || attr === "data-i18n" || attr === "data_i18next" || attr === "data-i18next") {
4396
- data_i18next = attrs[attr];
4397
- el.setAttribute("data-i18n", data_i18next);
4397
+ if (attrs[attr] !== null && attrs[attr] !== void 0) {
4398
+ data_i18next = attrs[attr];
4399
+ el.setAttribute("data-i18n", data_i18next);
4400
+ }
4398
4401
  } else el.setAttribute(attr, attrs[attr]);
4399
4402
  if (is_string(content)) {
4400
4403
  content = content.trim();
@@ -4467,6 +4470,14 @@
4467
4470
  break;
4468
4471
  }
4469
4472
  });
4473
+ element.querySelectorAll("[data-i18n-title]").forEach(function(elem) {
4474
+ let value = elem.getAttribute("data-i18n-title");
4475
+ if (value) elem.setAttribute("title", t(value));
4476
+ });
4477
+ element.querySelectorAll("[data-i18n-aria-label]").forEach(function(elem) {
4478
+ let value = elem.getAttribute("data-i18n-aria-label");
4479
+ if (value) elem.setAttribute("aria-label", t(value));
4480
+ });
4470
4481
  }
4471
4482
  /************************************************************
4472
4483
  * Example Usage
@@ -5847,6 +5858,17 @@
5847
5858
  remote_yuno_role: priv.remote_yuno_role,
5848
5859
  remote_yuno_service: priv.remote_yuno_service
5849
5860
  });
5861
+ } else {
5862
+ log_warning(`${gobj_short_name(gobj)}: EV_ON_OPEN_ERROR cannot open ${url} (Code: ${e.code}, Reason: "${e.reason}", Clean: ${e.wasClean})`);
5863
+ gobj_publish_event(gobj, "EV_ON_OPEN_ERROR", {
5864
+ url,
5865
+ remote_yuno_name: priv.remote_yuno_name,
5866
+ remote_yuno_role: priv.remote_yuno_role,
5867
+ remote_yuno_service: priv.remote_yuno_service,
5868
+ code: e.code,
5869
+ reason: e.reason,
5870
+ was_clean: e.wasClean
5871
+ });
5850
5872
  }
5851
5873
  if (gobj_is_running(gobj)) set_timeout(priv.gobj_timer, gobj_read_integer_attr(gobj, "timeout_retry"));
5852
5874
  return 0;
@@ -6077,6 +6099,7 @@
6077
6099
  ["EV_MT_COMMAND", event_flag_t.EVF_PUBLIC_EVENT],
6078
6100
  ["EV_ON_OPEN", event_flag_t.EVF_OUTPUT_EVENT | event_flag_t.EVF_NO_WARN_SUBS],
6079
6101
  ["EV_ON_CLOSE", event_flag_t.EVF_OUTPUT_EVENT | event_flag_t.EVF_NO_WARN_SUBS],
6102
+ ["EV_ON_OPEN_ERROR", event_flag_t.EVF_OUTPUT_EVENT | event_flag_t.EVF_NO_WARN_SUBS],
6080
6103
  ["EV_TIMEOUT", 0],
6081
6104
  [null, 0]
6082
6105
  ], states, gmt, 0, attrs_table, PRIVATE_DATA, 0, 0, 0, gclass_flag_t.gcflag_no_check_output_events);