@yuneta/gobj-js 7.26.1 → 7.26.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.
- package/dist/gobj-js.cjs.js +129 -36
- package/dist/gobj-js.cjs.js.map +1 -1
- package/dist/gobj-js.cjs.min.js +1013 -978
- package/dist/gobj-js.cjs.min.js.map +1 -1
- package/dist/gobj-js.es.js +126 -37
- package/dist/gobj-js.es.js.map +1 -1
- package/dist/gobj-js.es.min.js +394 -357
- package/dist/gobj-js.es.min.js.map +1 -1
- package/dist/gobj-js.iife.js +129 -36
- package/dist/gobj-js.iife.js.map +1 -1
- package/dist/gobj-js.iife.min.js +1070 -1035
- package/dist/gobj-js.iife.min.js.map +1 -1
- package/dist/gobj-js.umd.js +129 -36
- package/dist/gobj-js.umd.js.map +1 -1
- package/dist/gobj-js.umd.min.js +1070 -1035
- package/dist/gobj-js.umd.min.js.map +1 -1
- package/package.json +3 -3
package/dist/gobj-js.es.js
CHANGED
|
@@ -907,7 +907,7 @@ function json2item(gobj, sdata, it, jn_value_) {
|
|
|
907
907
|
}
|
|
908
908
|
if (jn_value2 === void 0) log_error(`${gobj_short_name(gobj)}: attr undefined: ${it.name}`);
|
|
909
909
|
sdata[it.name] = jn_value2;
|
|
910
|
-
if (is_object(gobj.priv) &&
|
|
910
|
+
if (is_object(gobj.priv) && Object.prototype.hasOwnProperty.call(gobj.priv, it.name)) gobj.priv[it.name] = jn_value2;
|
|
911
911
|
if (gobj.obflag & obflag_t.obflag_created && !(gobj.obflag & obflag_t.obflag_destroyed)) {
|
|
912
912
|
if (gobj.gclass.gmt.mt_writing) gobj.gclass.gmt.mt_writing(gobj, it.name);
|
|
913
913
|
}
|
|
@@ -2110,7 +2110,7 @@ function gobj_has_attr(gobj, name) {
|
|
|
2110
2110
|
function gobj_read_attr(gobj, name, src) {
|
|
2111
2111
|
let jn_attrs = gobj.jn_attrs;
|
|
2112
2112
|
if (name in jn_attrs) {
|
|
2113
|
-
if (
|
|
2113
|
+
if (Object.prototype.hasOwnProperty.call(jn_attrs, name)) {
|
|
2114
2114
|
let value = jn_attrs[name];
|
|
2115
2115
|
if (gobj.gclass.gmt.mt_reading) return gobj.gclass.gmt.mt_reading(gobj, name, value);
|
|
2116
2116
|
return value;
|
|
@@ -2216,9 +2216,9 @@ function gobj_write_attr(gobj, path, value, src) {
|
|
|
2216
2216
|
if (ss.length <= 1) {
|
|
2217
2217
|
let key = path;
|
|
2218
2218
|
if (key in jn_attrs) {
|
|
2219
|
-
if (
|
|
2219
|
+
if (Object.prototype.hasOwnProperty.call(jn_attrs, key)) {
|
|
2220
2220
|
jn_attrs[key] = value;
|
|
2221
|
-
if (is_object(gobj.priv) &&
|
|
2221
|
+
if (is_object(gobj.priv) && Object.prototype.hasOwnProperty.call(gobj.priv, key)) gobj.priv[key] = value;
|
|
2222
2222
|
if (gobj.obflag & obflag_t.obflag_created && !(gobj.obflag & obflag_t.obflag_destroyed)) {
|
|
2223
2223
|
if (gobj.gclass.gmt.mt_writing) gobj.gclass.gmt.mt_writing(gobj, key);
|
|
2224
2224
|
}
|
|
@@ -2239,9 +2239,9 @@ function gobj_write_attr(gobj, path, value, src) {
|
|
|
2239
2239
|
}
|
|
2240
2240
|
let jn_attrs = gobj.jn_attrs;
|
|
2241
2241
|
if (key in jn_attrs) {
|
|
2242
|
-
if (
|
|
2242
|
+
if (Object.prototype.hasOwnProperty.call(jn_attrs, key)) {
|
|
2243
2243
|
jn_attrs[key] = value;
|
|
2244
|
-
if (is_object(gobj.priv) &&
|
|
2244
|
+
if (is_object(gobj.priv) && Object.prototype.hasOwnProperty.call(gobj.priv, key)) gobj.priv[key] = value;
|
|
2245
2245
|
if (gobj.obflag & obflag_t.obflag_created && !(gobj.obflag & obflag_t.obflag_destroyed)) {
|
|
2246
2246
|
if (gobj.gclass.gmt.mt_writing) gobj.gclass.gmt.mt_writing(gobj, key);
|
|
2247
2247
|
}
|
|
@@ -2268,7 +2268,7 @@ function sdata_write_default_values(gobj, include_flag, exclude_flag) {
|
|
|
2268
2268
|
if (exclude_flag && it.flag & exclude_flag) continue;
|
|
2269
2269
|
if (include_flag === -1 || it.flag & include_flag) {
|
|
2270
2270
|
set_default(gobj, gobj.jn_attrs, it);
|
|
2271
|
-
if (is_object(gobj.priv) &&
|
|
2271
|
+
if (is_object(gobj.priv) && Object.prototype.hasOwnProperty.call(gobj.priv, it.name)) gobj.priv[it.name] = gobj.jn_attrs[it.name];
|
|
2272
2272
|
if (gobj.gclass.gmt.mt_writing) gobj.gclass.gmt.mt_writing(gobj, it.name);
|
|
2273
2273
|
}
|
|
2274
2274
|
}
|
|
@@ -2302,7 +2302,7 @@ function gobj_write_bool_attr(gobj, name, value) {
|
|
|
2302
2302
|
let hs = gobj_hsdata2(gobj, name, false);
|
|
2303
2303
|
if (hs) {
|
|
2304
2304
|
hs[name] = parseBoolean(value);
|
|
2305
|
-
if (is_object(gobj.priv) &&
|
|
2305
|
+
if (is_object(gobj.priv) && Object.prototype.hasOwnProperty.call(gobj.priv, name)) gobj.priv[name] = hs[name];
|
|
2306
2306
|
if (gobj.obflag & obflag_t.obflag_created && !(gobj.obflag & obflag_t.obflag_destroyed)) {
|
|
2307
2307
|
if (gobj.gclass.gmt.mt_writing) gobj.gclass.gmt.mt_writing(gobj, name);
|
|
2308
2308
|
}
|
|
@@ -2318,7 +2318,7 @@ function gobj_write_integer_attr(gobj, name, value) {
|
|
|
2318
2318
|
let hs = gobj_hsdata2(gobj, name, false);
|
|
2319
2319
|
if (hs) {
|
|
2320
2320
|
hs[name] = parseInt(value);
|
|
2321
|
-
if (is_object(gobj.priv) &&
|
|
2321
|
+
if (is_object(gobj.priv) && Object.prototype.hasOwnProperty.call(gobj.priv, name)) gobj.priv[name] = hs[name];
|
|
2322
2322
|
if (gobj.obflag & obflag_t.obflag_created && !(gobj.obflag & obflag_t.obflag_destroyed)) {
|
|
2323
2323
|
if (gobj.gclass.gmt.mt_writing) gobj.gclass.gmt.mt_writing(gobj, name);
|
|
2324
2324
|
}
|
|
@@ -2334,7 +2334,7 @@ function gobj_write_str_attr(gobj, name, value) {
|
|
|
2334
2334
|
let hs = gobj_hsdata2(gobj, name, false);
|
|
2335
2335
|
if (hs) {
|
|
2336
2336
|
hs[name] = String(value);
|
|
2337
|
-
if (is_object(gobj.priv) &&
|
|
2337
|
+
if (is_object(gobj.priv) && Object.prototype.hasOwnProperty.call(gobj.priv, name)) gobj.priv[name] = hs[name];
|
|
2338
2338
|
if (gobj.obflag & obflag_t.obflag_created && !(gobj.obflag & obflag_t.obflag_destroyed)) {
|
|
2339
2339
|
if (gobj.gclass.gmt.mt_writing) gobj.gclass.gmt.mt_writing(gobj, name);
|
|
2340
2340
|
}
|
|
@@ -2722,8 +2722,8 @@ function _subscription_match_kw(kw, event) {
|
|
|
2722
2722
|
kw,
|
|
2723
2723
|
renamed_event: ""
|
|
2724
2724
|
};
|
|
2725
|
-
let kw_match =
|
|
2726
|
-
let config_match =
|
|
2725
|
+
let kw_match = json_object_update({}, kw);
|
|
2726
|
+
let config_match = json_object_update({}, __config__);
|
|
2727
2727
|
kw_match.__config__ = config_match;
|
|
2728
2728
|
let renamed_event = "";
|
|
2729
2729
|
let rename = config_match.__rename_event_name__;
|
|
@@ -2731,7 +2731,7 @@ function _subscription_match_kw(kw, event) {
|
|
|
2731
2731
|
if (event_type) {
|
|
2732
2732
|
renamed_event = event_type.event_name;
|
|
2733
2733
|
delete config_match.__rename_event_name__;
|
|
2734
|
-
if (event && json_size(kw_match.__global__) > 0) kw_match.__global__ =
|
|
2734
|
+
if (event && json_size(kw_match.__global__) > 0) kw_match.__global__ = json_object_update(json_object_update({}, kw_match.__global__), { __original_event_name__: event });
|
|
2735
2735
|
}
|
|
2736
2736
|
delete config_match.__hard_subscription__;
|
|
2737
2737
|
delete config_match.__own_event__;
|
|
@@ -3107,7 +3107,7 @@ function gobj_publish_event(publisher, event, kw) {
|
|
|
3107
3107
|
}
|
|
3108
3108
|
}
|
|
3109
3109
|
let kw2publish = kw;
|
|
3110
|
-
if (json_size(__local__) > 0 || json_size(__global__) > 0) kw2publish =
|
|
3110
|
+
if (json_size(__local__) > 0 || json_size(__global__) > 0) kw2publish = json_object_update({}, kw);
|
|
3111
3111
|
if (json_size(__local__) > 0) kw_pop(kw2publish, __local__);
|
|
3112
3112
|
if (__config__) {}
|
|
3113
3113
|
if (json_size(__global__) > 0) json_object_update(kw2publish, json_deep_copy(__global__));
|
|
@@ -3644,10 +3644,7 @@ function json_deep_copy(obj) {
|
|
|
3644
3644
|
************************************************************/
|
|
3645
3645
|
function duplicate_objects(...sourceObjects) {
|
|
3646
3646
|
const result = {};
|
|
3647
|
-
for (const obj of sourceObjects)
|
|
3648
|
-
const clonedObj = structuredClone(obj);
|
|
3649
|
-
Object.assign(result, clonedObj);
|
|
3650
|
-
}
|
|
3647
|
+
for (const obj of sourceObjects) json_object_update(result, structuredClone(obj));
|
|
3651
3648
|
return result;
|
|
3652
3649
|
}
|
|
3653
3650
|
/************************************************************
|
|
@@ -4020,6 +4017,13 @@ function kw_find_path(gobj, kw, path, verbose) {
|
|
|
4020
4017
|
let ss = path.split("`");
|
|
4021
4018
|
let len = ss.length;
|
|
4022
4019
|
for (let i = 0; i < len; i++) {
|
|
4020
|
+
if (is_array(kw)) {
|
|
4021
|
+
if (!/^[0-9]+$/.test(ss[i])) {
|
|
4022
|
+
if (verbose) log_error(`${prefix}path not found: '${path}'`);
|
|
4023
|
+
return;
|
|
4024
|
+
}
|
|
4025
|
+
ss[i] = String(Number(ss[i]));
|
|
4026
|
+
}
|
|
4023
4027
|
if (is_prototype_segment(kw, ss[i])) {
|
|
4024
4028
|
if (verbose) log_error(`${prefix}path not found: '${path}'`);
|
|
4025
4029
|
return;
|
|
@@ -4437,7 +4441,7 @@ function kw_set_subdict_value(gobj, kw, path, key, value) {
|
|
|
4437
4441
|
log_error("subdict is not an object");
|
|
4438
4442
|
return -1;
|
|
4439
4443
|
}
|
|
4440
|
-
subdict
|
|
4444
|
+
set_own_key(subdict, key, value);
|
|
4441
4445
|
return 0;
|
|
4442
4446
|
}
|
|
4443
4447
|
/***************************************************************************
|
|
@@ -4745,7 +4749,7 @@ function kwid_new_dict(gobj, kw, path) {
|
|
|
4745
4749
|
else if (is_array(kw)) for (let i = 0; i < kw.length; i++) {
|
|
4746
4750
|
let kv = kw[i];
|
|
4747
4751
|
let id = kw_get_str(gobj, kv, "id", "", kw_flag_t.KW_REQUIRED);
|
|
4748
|
-
if (!empty_string(id)) new_dict
|
|
4752
|
+
if (!empty_string(id)) set_own_key(new_dict, id, kv);
|
|
4749
4753
|
}
|
|
4750
4754
|
else log_error(`${gobj_short_name(gobj)} kwid_new_dict: data type unknown`);
|
|
4751
4755
|
return new_dict;
|
|
@@ -5191,11 +5195,11 @@ function jdb_update(jdb, topic_name, path, kw) {
|
|
|
5191
5195
|
}
|
|
5192
5196
|
if (ids.length === 0 && v) {
|
|
5193
5197
|
if (is_array(v)) v.push(kw);
|
|
5194
|
-
else if (v["id"] === kw["id"])
|
|
5198
|
+
else if (v["id"] === kw["id"]) json_object_update(v, kw);
|
|
5195
5199
|
else {
|
|
5196
5200
|
let v_ = kw_get_dict_value(null, v, jdb.hook, [], 1);
|
|
5197
5201
|
let v__ = _jdb_get(v_, jdb.hook, kw["id"], false);
|
|
5198
|
-
if (v__)
|
|
5202
|
+
if (v__) json_object_update(v__, kw);
|
|
5199
5203
|
else v_.push(kw);
|
|
5200
5204
|
}
|
|
5201
5205
|
}
|
|
@@ -5396,6 +5400,68 @@ function safeSrc(url) {
|
|
|
5396
5400
|
/***************************************************************************
|
|
5397
5401
|
*
|
|
5398
5402
|
***************************************************************************/
|
|
5403
|
+
/***************************************************************************
|
|
5404
|
+
* Markup that createElement2() inserts AS HTML, said out loud.
|
|
5405
|
+
*
|
|
5406
|
+
* createElement2() reads a string that starts with '<' as markup. That
|
|
5407
|
+
* decision depends on the CONTENT of the string, not on who wrote it, so
|
|
5408
|
+
* a value from a backend or typed by a user that starts with '<' runs as
|
|
5409
|
+
* html. html_markup() is the explicit way to ask for markup: the string
|
|
5410
|
+
* is the caller's own (an icon, an svg), never data.
|
|
5411
|
+
*
|
|
5412
|
+
* ['span', {class: 'icon'}, html_markup('<i class="yi-copy"></i>')]
|
|
5413
|
+
*
|
|
5414
|
+
* With set_strings_are_text(true) a plain string is ALWAYS text and
|
|
5415
|
+
* html_markup() is the only way to insert markup.
|
|
5416
|
+
***************************************************************************/
|
|
5417
|
+
var HtmlMarkup = class {
|
|
5418
|
+
constructor(html) {
|
|
5419
|
+
this.html = html;
|
|
5420
|
+
Object.freeze(this);
|
|
5421
|
+
}
|
|
5422
|
+
toString() {
|
|
5423
|
+
return this.html;
|
|
5424
|
+
}
|
|
5425
|
+
};
|
|
5426
|
+
function html_markup(html) {
|
|
5427
|
+
if (typeof html !== "string") {
|
|
5428
|
+
log_error(`html_markup: not a string, type ${typeof html}`);
|
|
5429
|
+
return new HtmlMarkup("");
|
|
5430
|
+
}
|
|
5431
|
+
return new HtmlMarkup(html);
|
|
5432
|
+
}
|
|
5433
|
+
function is_html_markup(v) {
|
|
5434
|
+
return v instanceof HtmlMarkup;
|
|
5435
|
+
}
|
|
5436
|
+
function markup_fragment(markup) {
|
|
5437
|
+
const template = document.createElement("template");
|
|
5438
|
+
template.innerHTML = markup.html.trim();
|
|
5439
|
+
return template.content;
|
|
5440
|
+
}
|
|
5441
|
+
var __strings_are_text__ = false;
|
|
5442
|
+
var __markup_strings_warned__ = /* @__PURE__ */ new Set();
|
|
5443
|
+
/***************************************************************************
|
|
5444
|
+
* The mode of createElement2() for a plain string that starts with '<':
|
|
5445
|
+
* false (default): it is markup, as it always was.
|
|
5446
|
+
* true: it is TEXT; markup is asked for with html_markup().
|
|
5447
|
+
* An app turns it on once its own code and the libraries it mounts pass
|
|
5448
|
+
* every deliberate markup through html_markup(). A string that starts
|
|
5449
|
+
* with '<' is then logged once (a deliberate one not migrated yet, or a
|
|
5450
|
+
* datum that used to run as html).
|
|
5451
|
+
***************************************************************************/
|
|
5452
|
+
function set_strings_are_text(on) {
|
|
5453
|
+
__strings_are_text__ = !!on;
|
|
5454
|
+
}
|
|
5455
|
+
function strings_are_text() {
|
|
5456
|
+
return __strings_are_text__;
|
|
5457
|
+
}
|
|
5458
|
+
function warn_markup_string(content) {
|
|
5459
|
+
if (__markup_strings_warned__.size >= 100) return;
|
|
5460
|
+
const key = content.slice(0, 80);
|
|
5461
|
+
if (__markup_strings_warned__.has(key)) return;
|
|
5462
|
+
__markup_strings_warned__.add(key);
|
|
5463
|
+
log_warning(`createElement2: a string that starts with '<' is TEXT (set_strings_are_text): use html_markup() if it is markup: ${JSON.stringify(key)}`);
|
|
5464
|
+
}
|
|
5399
5465
|
function createOneHtml(htmlString) {
|
|
5400
5466
|
const template = document.createElement("template");
|
|
5401
5467
|
template.innerHTML = htmlString.trim();
|
|
@@ -5557,11 +5623,18 @@ parent: document.body
|
|
|
5557
5623
|
* if string begins with '<' then
|
|
5558
5624
|
* it will be converted to HTMLElement
|
|
5559
5625
|
* content = createOneHtml(string)
|
|
5626
|
+
* | html_markup(string): markup, said out loud (any mode)
|
|
5560
5627
|
* ⚠️ So a string is MARKUP when it starts with '<': never
|
|
5561
5628
|
* pass DATA (a value from a backend, a name a user typed)
|
|
5562
5629
|
* as a bare string, or "<img src=x onerror=...>" runs.
|
|
5563
5630
|
* Pass it as a Text node, which is always text:
|
|
5564
5631
|
* ['span', {}, document.createTextNode(value)]
|
|
5632
|
+
* In a LIST of children a node (element, svg, Text) is
|
|
5633
|
+
* appended as it is and a string is always text -- but a
|
|
5634
|
+
* list whose first item is a string is read as ONE
|
|
5635
|
+
* description (the string is its tag).
|
|
5636
|
+
* With set_strings_are_text(true) a plain string is
|
|
5637
|
+
* always text, and markup only comes in html_markup().
|
|
5565
5638
|
* if attrs['i18n'] is not empty then (or 'data-i18n' or 'data_i18next')
|
|
5566
5639
|
* it will be overridden with the translation
|
|
5567
5640
|
* content = translate(attrs['i18n']));
|
|
@@ -5604,18 +5677,26 @@ function createElement2(description, translate_fn) {
|
|
|
5604
5677
|
el.setAttribute("data-i18n", data_i18next);
|
|
5605
5678
|
}
|
|
5606
5679
|
} else el.setAttribute(attr, attrs[attr]);
|
|
5607
|
-
if (
|
|
5680
|
+
if (is_html_markup(content)) el.appendChild(markup_fragment(content));
|
|
5681
|
+
else if (is_string(content)) {
|
|
5608
5682
|
content = content.trim();
|
|
5609
|
-
if (content.length > 0 && content[0] === "<") el.appendChild(createOneHtml(content));
|
|
5610
|
-
else
|
|
5611
|
-
|
|
5612
|
-
|
|
5613
|
-
|
|
5683
|
+
if (content.length > 0 && content[0] === "<" && !__strings_are_text__) el.appendChild(createOneHtml(content));
|
|
5684
|
+
else {
|
|
5685
|
+
if (content.length > 0 && content[0] === "<") warn_markup_string(content);
|
|
5686
|
+
if (translate_fn && data_i18next) {
|
|
5687
|
+
let translated = translate_fn(data_i18next);
|
|
5688
|
+
el.textContent = translated ? translated : content;
|
|
5689
|
+
} else el.textContent = content;
|
|
5690
|
+
}
|
|
5614
5691
|
} else if (is_array(content)) {
|
|
5615
5692
|
if (content.length > 0) {
|
|
5616
5693
|
if (is_string(content[0])) el.appendChild(createElement2(content, translate_fn));
|
|
5617
|
-
else for (let child of content) if (Array.isArray(child)
|
|
5618
|
-
|
|
5694
|
+
else for (let child of content) if (Array.isArray(child)) {
|
|
5695
|
+
if (child.length > 0) el.appendChild(createElement2(child, translate_fn));
|
|
5696
|
+
} else if (child instanceof Node) el.appendChild(child);
|
|
5697
|
+
else if (is_html_markup(child)) el.appendChild(markup_fragment(child));
|
|
5698
|
+
else if (is_string(child)) el.appendChild(document.createTextNode(child));
|
|
5699
|
+
else if (child !== null && child !== void 0 && child !== false) log_error(`createElement2: child ignored, type ${typeof child}`);
|
|
5619
5700
|
}
|
|
5620
5701
|
} else if (content instanceof HTMLElement || content instanceof Text || content instanceof SVGElement) el.appendChild(content);
|
|
5621
5702
|
else if (content != null) {
|
|
@@ -6048,12 +6129,12 @@ function flat_diff(flat1, flat2) {
|
|
|
6048
6129
|
removed: {},
|
|
6049
6130
|
changed: {}
|
|
6050
6131
|
};
|
|
6051
|
-
for (const key of Object.keys(a)) if (!Object.prototype.hasOwnProperty.call(b, key)) diff.removed
|
|
6052
|
-
else if (!flat_value_equal(a[key], b[key])) diff.changed
|
|
6132
|
+
for (const key of Object.keys(a)) if (!Object.prototype.hasOwnProperty.call(b, key)) set_own_key(diff.removed, key, a[key]);
|
|
6133
|
+
else if (!flat_value_equal(a[key], b[key])) set_own_key(diff.changed, key, {
|
|
6053
6134
|
from: a[key],
|
|
6054
6135
|
to: b[key]
|
|
6055
|
-
};
|
|
6056
|
-
for (const key of Object.keys(b)) if (!Object.prototype.hasOwnProperty.call(a, key)) diff.added
|
|
6136
|
+
});
|
|
6137
|
+
for (const key of Object.keys(b)) if (!Object.prototype.hasOwnProperty.call(a, key)) set_own_key(diff.added, key, b[key]);
|
|
6057
6138
|
return diff;
|
|
6058
6139
|
}
|
|
6059
6140
|
/************************************************************
|
|
@@ -7161,7 +7242,7 @@ function mt_inject_event(gobj, event, kw, src) {
|
|
|
7161
7242
|
window.console.error(`Not in session`);
|
|
7162
7243
|
return -1;
|
|
7163
7244
|
}
|
|
7164
|
-
kw =
|
|
7245
|
+
kw = json_object_update({}, is_object(kw) ? kw : {});
|
|
7165
7246
|
if (is_object(kw["__md_iev__"])) kw["__md_iev__"] = json_deep_copy(kw["__md_iev__"]);
|
|
7166
7247
|
if (msg_iev_get_stack(gobj, kw, IEVENT_STACK_ID)) {} else {
|
|
7167
7248
|
let jn_ievent_id = build_cli_ievent_request(gobj, gobj_name(src), kw_get_str(gobj, kw, "__service__", 0, 0));
|
|
@@ -7219,6 +7300,13 @@ function setup_websocket(gobj) {
|
|
|
7219
7300
|
websocket = new WebSocket(url);
|
|
7220
7301
|
} catch (e) {
|
|
7221
7302
|
log_error(`${gobj_short_name(gobj)}: Cannot open WebSocket to '${url}', Error: ${e.message}`);
|
|
7303
|
+
gobj_post_event(gobj, "EV_ON_CLOSE", {
|
|
7304
|
+
url,
|
|
7305
|
+
ws_seq,
|
|
7306
|
+
code: 1006,
|
|
7307
|
+
reason: e.message,
|
|
7308
|
+
was_clean: false
|
|
7309
|
+
}, gobj);
|
|
7222
7310
|
return null;
|
|
7223
7311
|
}
|
|
7224
7312
|
if (!websocket) {
|
|
@@ -7477,6 +7565,7 @@ function ac_on_open(gobj, event, kw, src) {
|
|
|
7477
7565
|
function ac_on_close(gobj, event, kw, src) {
|
|
7478
7566
|
let priv = gobj.priv;
|
|
7479
7567
|
let url = kw.url;
|
|
7568
|
+
if (kw.ws_seq !== void 0 && kw.ws_seq !== priv.ws_seq) return 0;
|
|
7480
7569
|
set_remote_log_functions();
|
|
7481
7570
|
log_warning(`${gobj_short_name(gobj)}: WebSocket closed ${url} (Code: ${kw.code}, Reason: "${kw.reason}", Clean: ${kw.was_clean})`);
|
|
7482
7571
|
if (priv.websocket) {
|
|
@@ -7494,7 +7583,7 @@ function ac_on_close(gobj, event, kw, src) {
|
|
|
7494
7583
|
remote_yuno_role: priv.remote_yuno_role,
|
|
7495
7584
|
remote_yuno_service: priv.remote_yuno_service
|
|
7496
7585
|
});
|
|
7497
|
-
} else {
|
|
7586
|
+
} else if (!gobj_is_running(gobj)) {} else {
|
|
7498
7587
|
log_warning(`${gobj_short_name(gobj)}: EV_ON_OPEN_ERROR cannot open ${url} (Code: ${kw.code}, Reason: "${kw.reason}", Clean: ${kw.was_clean})`);
|
|
7499
7588
|
gobj_publish_event(gobj, "EV_ON_OPEN_ERROR", {
|
|
7500
7589
|
url,
|
|
@@ -7795,6 +7884,6 @@ function register_c_ievent_cli() {
|
|
|
7795
7884
|
return create_gclass(GCLASS_NAME);
|
|
7796
7885
|
}
|
|
7797
7886
|
//#endregion
|
|
7798
|
-
export { GObj, SDATA, SDATAAUTHZ, SDATACM, SDATACM2, SDATADF, SDATAPM, SDATAPM0, SDATA_END, SDataDesc, YUNETA_VERSION, __yuno__, build_command_response, build_path, build_stats_response, clean_name, clear_timeout, cmp_two_simple_json, command_parser, createElement2, createOneHtml, create_json_record, create_template_record, current_timestamp, data_type_t, db_list_persistent_attrs, db_load_persistent_attrs, db_remove_persistent_attrs, db_save_persistent_attrs, debounce, delete_from_list, duplicate_objects, empty_json, empty_string, escapeHtml, event_flag_t, flat2json, flat_apply, flat_diff, flat_key_join, flat_key_split, gclass_add_ev_action, gclass_add_event_type, gclass_add_state, gclass_check_fsm, gclass_create, gclass_event_type, gclass_find_by_name, gclass_flag_t, gclass_unregister, getPositionRelativeToBody, get_function_name, get_now, gobj_bottom_gobj, gobj_change_parent, gobj_change_state, gobj_command, gobj_create, gobj_create2, gobj_create_default_service, gobj_create_pure_child, gobj_create_service, gobj_create_volatil, gobj_create_yuno, gobj_current_state, gobj_default_service, gobj_deliver_posted_events, gobj_destroy, gobj_find_child, gobj_find_gobj, gobj_find_service, gobj_find_subscribings, gobj_find_subscriptions, gobj_flag_t, gobj_full_name, gobj_gclass_name, gobj_get_gclass_trace_level, gobj_get_gclass_trace_level2, gobj_get_gclass_trace_no_level, gobj_get_global_trace_level, gobj_get_global_trace_no_level, gobj_global_trace_level, gobj_global_trace_no_level, gobj_has_attr, gobj_has_event, gobj_has_output_event, gobj_hsdata, gobj_is_destroying, gobj_is_playing, gobj_is_pure_child, gobj_is_running, gobj_is_service, gobj_is_volatil, gobj_list_persistent_attrs, gobj_list_subscriptions, gobj_load_persistent_attrs, gobj_match_children, gobj_match_children_tree, gobj_match_gobj, gobj_name, gobj_parent, gobj_pause, gobj_play, gobj_post_event, gobj_posted_events_size, gobj_publish_event, gobj_read_attr, gobj_read_attrs, gobj_read_bool_attr, gobj_read_integer_attr, gobj_read_pointer_attr, gobj_read_str_attr, gobj_remove_persistent_attrs, gobj_repr_global_trace_levels, gobj_reset_volatil_attrs, gobj_save_persistent_attrs, gobj_search_path, gobj_send_event, gobj_services, gobj_set_bottom_gobj, gobj_set_deep_trace, gobj_set_gclass_no_trace, gobj_set_gclass_trace, gobj_set_global_no_trace, gobj_set_global_no_trace2, gobj_set_global_trace, gobj_set_global_trace2, gobj_set_gobj_no_trace, gobj_set_gobj_trace, gobj_set_trace_machine_format, gobj_short_name, gobj_start, gobj_start_children, gobj_start_tree, gobj_start_up, gobj_stats, gobj_stop, gobj_stop_children, gobj_stop_tree, gobj_subscribe_event, gobj_trace_level, gobj_trace_machine_format, gobj_trace_no_level, gobj_unsubscribe_event, gobj_unsubscribe_list, gobj_walk_gobj_children, gobj_walk_gobj_children_tree, gobj_write_attr, gobj_write_attrs, gobj_write_bool_attr, gobj_write_integer_attr, gobj_write_str_attr, gobj_yuno, gobj_yuno_id, gobj_yuno_name, gobj_yuno_role, id_index_in_obj_list, index_in_list, is_array, is_boolean, is_date, is_function, is_gobj, is_metadata_key, is_null, is_number, is_object, is_private_key, is_pure_number, is_secret_name, is_string, jdb_delete, jdb_get, jdb_get_by_idx, jdb_get_topic, jdb_init, jdb_update, json2flat, json_array_append, json_array_append_new, json_array_extend, json_array_remove, json_array_size, json_deep_copy, json_is_identical, json_mask_secrets, json_object_del, json_object_get, json_object_set, json_object_set_new, json_object_size, json_object_update, json_object_update_existing, json_object_update_missing, json_size, jwt2json, jwtDecode, kw_clone_by_keys, kw_clone_by_not_keys, kw_collect, kw_delete, kw_find_json_in_list, kw_find_path, kw_flag_t, kw_get_bool, kw_get_dict, kw_get_dict_value, kw_get_int, kw_get_list, kw_get_local_storage_value, kw_get_pointer, kw_get_real, kw_get_str, kw_has_key, kw_match_simple, kw_pop, kw_remove_local_storage_value, kw_select, kw_set_dict_value, kw_set_local_storage_value, kw_set_subdict_value, kwid_collect, kwid_find_one_record, kwid_get_ids, kwid_match_id, kwid_new_dict, kwid_new_list, list2options, load_json_file, log_debug, log_error, log_info, log_warning, mask_secrets_inline, msg_iev_get_msg_type, msg_iev_get_stack, msg_iev_push_stack, msg_iev_read_key, msg_iev_set_msg_type, msg_iev_write_key, node_uuid, parseBoolean, parseSVG, refresh_language, register_c_ievent_cli, register_c_timer, register_c_yuno, safeSrc, sdata_flag_t, send_http_json_post, set_console_log_enabled, set_console_log_filter, set_log_callback, set_remote_log_functions, set_timeout, set_timeout_periodic, sprintf, stats_parser, str_in_list, strcasecmp, strcmp, strncmp, strs_in_list, strstr, template_get_field_desc, timeTracker, trace_json, trace_json_masked, trace_level_t, trace_msg, treedb_decoder_fkey, treedb_decoder_hook, treedb_encoder_fkey, treedb_get_field_desc, treedb_hook_data_size, vsprintf, walk_type_t };
|
|
7887
|
+
export { GObj, SDATA, SDATAAUTHZ, SDATACM, SDATACM2, SDATADF, SDATAPM, SDATAPM0, SDATA_END, SDataDesc, YUNETA_VERSION, __yuno__, build_command_response, build_path, build_stats_response, clean_name, clear_timeout, cmp_two_simple_json, command_parser, createElement2, createOneHtml, create_json_record, create_template_record, current_timestamp, data_type_t, db_list_persistent_attrs, db_load_persistent_attrs, db_remove_persistent_attrs, db_save_persistent_attrs, debounce, delete_from_list, duplicate_objects, empty_json, empty_string, escapeHtml, event_flag_t, flat2json, flat_apply, flat_diff, flat_key_join, flat_key_split, gclass_add_ev_action, gclass_add_event_type, gclass_add_state, gclass_check_fsm, gclass_create, gclass_event_type, gclass_find_by_name, gclass_flag_t, gclass_unregister, getPositionRelativeToBody, get_function_name, get_now, gobj_bottom_gobj, gobj_change_parent, gobj_change_state, gobj_command, gobj_create, gobj_create2, gobj_create_default_service, gobj_create_pure_child, gobj_create_service, gobj_create_volatil, gobj_create_yuno, gobj_current_state, gobj_default_service, gobj_deliver_posted_events, gobj_destroy, gobj_find_child, gobj_find_gobj, gobj_find_service, gobj_find_subscribings, gobj_find_subscriptions, gobj_flag_t, gobj_full_name, gobj_gclass_name, gobj_get_gclass_trace_level, gobj_get_gclass_trace_level2, gobj_get_gclass_trace_no_level, gobj_get_global_trace_level, gobj_get_global_trace_no_level, gobj_global_trace_level, gobj_global_trace_no_level, gobj_has_attr, gobj_has_event, gobj_has_output_event, gobj_hsdata, gobj_is_destroying, gobj_is_playing, gobj_is_pure_child, gobj_is_running, gobj_is_service, gobj_is_volatil, gobj_list_persistent_attrs, gobj_list_subscriptions, gobj_load_persistent_attrs, gobj_match_children, gobj_match_children_tree, gobj_match_gobj, gobj_name, gobj_parent, gobj_pause, gobj_play, gobj_post_event, gobj_posted_events_size, gobj_publish_event, gobj_read_attr, gobj_read_attrs, gobj_read_bool_attr, gobj_read_integer_attr, gobj_read_pointer_attr, gobj_read_str_attr, gobj_remove_persistent_attrs, gobj_repr_global_trace_levels, gobj_reset_volatil_attrs, gobj_save_persistent_attrs, gobj_search_path, gobj_send_event, gobj_services, gobj_set_bottom_gobj, gobj_set_deep_trace, gobj_set_gclass_no_trace, gobj_set_gclass_trace, gobj_set_global_no_trace, gobj_set_global_no_trace2, gobj_set_global_trace, gobj_set_global_trace2, gobj_set_gobj_no_trace, gobj_set_gobj_trace, gobj_set_trace_machine_format, gobj_short_name, gobj_start, gobj_start_children, gobj_start_tree, gobj_start_up, gobj_stats, gobj_stop, gobj_stop_children, gobj_stop_tree, gobj_subscribe_event, gobj_trace_level, gobj_trace_machine_format, gobj_trace_no_level, gobj_unsubscribe_event, gobj_unsubscribe_list, gobj_walk_gobj_children, gobj_walk_gobj_children_tree, gobj_write_attr, gobj_write_attrs, gobj_write_bool_attr, gobj_write_integer_attr, gobj_write_str_attr, gobj_yuno, gobj_yuno_id, gobj_yuno_name, gobj_yuno_role, html_markup, id_index_in_obj_list, index_in_list, is_array, is_boolean, is_date, is_function, is_gobj, is_html_markup, is_metadata_key, is_null, is_number, is_object, is_private_key, is_pure_number, is_secret_name, is_string, jdb_delete, jdb_get, jdb_get_by_idx, jdb_get_topic, jdb_init, jdb_update, json2flat, json_array_append, json_array_append_new, json_array_extend, json_array_remove, json_array_size, json_deep_copy, json_is_identical, json_mask_secrets, json_object_del, json_object_get, json_object_set, json_object_set_new, json_object_size, json_object_update, json_object_update_existing, json_object_update_missing, json_size, jwt2json, jwtDecode, kw_clone_by_keys, kw_clone_by_not_keys, kw_collect, kw_delete, kw_find_json_in_list, kw_find_path, kw_flag_t, kw_get_bool, kw_get_dict, kw_get_dict_value, kw_get_int, kw_get_list, kw_get_local_storage_value, kw_get_pointer, kw_get_real, kw_get_str, kw_has_key, kw_match_simple, kw_pop, kw_remove_local_storage_value, kw_select, kw_set_dict_value, kw_set_local_storage_value, kw_set_subdict_value, kwid_collect, kwid_find_one_record, kwid_get_ids, kwid_match_id, kwid_new_dict, kwid_new_list, list2options, load_json_file, log_debug, log_error, log_info, log_warning, mask_secrets_inline, msg_iev_get_msg_type, msg_iev_get_stack, msg_iev_push_stack, msg_iev_read_key, msg_iev_set_msg_type, msg_iev_write_key, node_uuid, parseBoolean, parseSVG, refresh_language, register_c_ievent_cli, register_c_timer, register_c_yuno, safeSrc, sdata_flag_t, send_http_json_post, set_console_log_enabled, set_console_log_filter, set_log_callback, set_remote_log_functions, set_strings_are_text, set_timeout, set_timeout_periodic, sprintf, stats_parser, str_in_list, strcasecmp, strcmp, strings_are_text, strncmp, strs_in_list, strstr, template_get_field_desc, timeTracker, trace_json, trace_json_masked, trace_level_t, trace_msg, treedb_decoder_fkey, treedb_decoder_hook, treedb_encoder_fkey, treedb_get_field_desc, treedb_hook_data_size, vsprintf, walk_type_t };
|
|
7799
7888
|
|
|
7800
7889
|
//# sourceMappingURL=gobj-js.es.js.map
|