@yuneta/gobj-js 7.9.9 → 7.9.11
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 +26 -10
- package/dist/gobj-js.cjs.js.map +1 -1
- package/dist/gobj-js.cjs.min.js +77 -77
- package/dist/gobj-js.cjs.min.js.map +1 -1
- package/dist/gobj-js.es.js +26 -10
- package/dist/gobj-js.es.js.map +1 -1
- package/dist/gobj-js.es.min.js +7 -7
- package/dist/gobj-js.es.min.js.map +1 -1
- package/dist/gobj-js.iife.js +26 -10
- package/dist/gobj-js.iife.js.map +1 -1
- package/dist/gobj-js.iife.min.js +7 -7
- package/dist/gobj-js.iife.min.js.map +1 -1
- package/dist/gobj-js.umd.js +26 -10
- package/dist/gobj-js.umd.js.map +1 -1
- package/dist/gobj-js.umd.min.js +7 -7
- package/dist/gobj-js.umd.min.js.map +1 -1
- package/package.json +1 -1
package/dist/gobj-js.cjs.js
CHANGED
|
@@ -5393,10 +5393,22 @@ function create_template_record(template, kw) {
|
|
|
5393
5393
|
* c_timer.js
|
|
5394
5394
|
*
|
|
5395
5395
|
* GClass Timer
|
|
5396
|
-
* High-level,
|
|
5397
|
-
* IN SECONDS! although the parameter is in milliseconds (msec)
|
|
5396
|
+
* High-level timer, fed by the browser's own timer service
|
|
5398
5397
|
*
|
|
5399
|
-
*
|
|
5398
|
+
* Don't use gobj_start()/gobj_stop(), USE set_timeout..(), clear_timeout()
|
|
5399
|
+
*
|
|
5400
|
+
* The CONTRACT is the C one (see c_timer.h), and it is the whole
|
|
5401
|
+
* public surface: set_timeout() arms, clear_timeout() disarms, and
|
|
5402
|
+
* a one-shot is done once it fires. Whether the gobj is running is
|
|
5403
|
+
* an INTERNAL matter of this gclass -- nobody asking for a timeout
|
|
5404
|
+
* has to know it exists, and no caller should have to pair a
|
|
5405
|
+
* set_timeout() with a gobj_start() to make it work.
|
|
5406
|
+
*
|
|
5407
|
+
* What feeds the timer is the only thing that differs from C, and
|
|
5408
|
+
* it is deliberately invisible from outside: there the gobj rides
|
|
5409
|
+
* the yuno's one-second heartbeat, here it is a native setTimeout().
|
|
5410
|
+
*
|
|
5411
|
+
* Copyright (c) 2025-2026, ArtGins.
|
|
5400
5412
|
* All Rights Reserved.
|
|
5401
5413
|
****************************************************************************/
|
|
5402
5414
|
/***************************************************************
|
|
@@ -5449,6 +5461,9 @@ function mt_writing$2(gobj, path) {
|
|
|
5449
5461
|
if (priv.msec > 0) priv.timer_id = setTimeout(function() {
|
|
5450
5462
|
gobj_send_event(gobj, "EV_TIMEOUT", {}, gobj);
|
|
5451
5463
|
}, priv.msec);
|
|
5464
|
+
if (priv.msec > 0) {
|
|
5465
|
+
if (!gobj_is_running(gobj)) gobj_start(gobj);
|
|
5466
|
+
} else if (gobj_is_running(gobj)) gobj_stop(gobj);
|
|
5452
5467
|
break;
|
|
5453
5468
|
}
|
|
5454
5469
|
}
|
|
@@ -5478,11 +5493,15 @@ function mt_destroy$2(gobj) {}
|
|
|
5478
5493
|
function ac_timeout$1(gobj, event, kw, src) {
|
|
5479
5494
|
let priv = gobj.priv;
|
|
5480
5495
|
let ev = priv.periodic ? "EV_TIMEOUT_PERIODIC" : "EV_TIMEOUT";
|
|
5481
|
-
if (
|
|
5482
|
-
else gobj_publish_event(gobj, ev, {});
|
|
5483
|
-
if (priv.periodic) priv.timer_id = setTimeout(function() {
|
|
5496
|
+
if (priv.periodic && priv.msec > 0) priv.timer_id = setTimeout(function() {
|
|
5484
5497
|
gobj_send_event(gobj, "EV_TIMEOUT", {}, gobj);
|
|
5485
5498
|
}, priv.msec);
|
|
5499
|
+
else priv.timer_id = -1;
|
|
5500
|
+
if (gobj_is_pure_child(gobj)) gobj_send_event(gobj_parent(gobj), ev, {}, gobj);
|
|
5501
|
+
else gobj_publish_event(gobj, ev, {});
|
|
5502
|
+
if (!priv.periodic && priv.timer_id === -1) {
|
|
5503
|
+
if (gobj_is_running(gobj)) gobj_stop(gobj);
|
|
5504
|
+
}
|
|
5486
5505
|
return 0;
|
|
5487
5506
|
}
|
|
5488
5507
|
/***************************
|
|
@@ -5635,7 +5654,6 @@ function mt_writing$1(gobj, path) {}
|
|
|
5635
5654
|
* Framework Method: Start
|
|
5636
5655
|
***************************************************************/
|
|
5637
5656
|
function mt_start$1(gobj) {
|
|
5638
|
-
gobj_start(gobj.priv.gobj_timer);
|
|
5639
5657
|
set_timeout_periodic(gobj.priv.gobj_timer, gobj.priv.periodic_timeout);
|
|
5640
5658
|
return 0;
|
|
5641
5659
|
}
|
|
@@ -5643,7 +5661,7 @@ function mt_start$1(gobj) {
|
|
|
5643
5661
|
* Framework Method: Stop
|
|
5644
5662
|
***************************************************************/
|
|
5645
5663
|
function mt_stop$1(gobj) {
|
|
5646
|
-
|
|
5664
|
+
clear_timeout(gobj.priv.gobj_timer);
|
|
5647
5665
|
gobj_stop_children(gobj);
|
|
5648
5666
|
return 0;
|
|
5649
5667
|
}
|
|
@@ -5815,7 +5833,6 @@ function mt_writing(gobj, path) {
|
|
|
5815
5833
|
***************************************************************/
|
|
5816
5834
|
function mt_start(gobj) {
|
|
5817
5835
|
let priv = gobj.priv;
|
|
5818
|
-
gobj_start(priv.gobj_timer);
|
|
5819
5836
|
priv.retry_ms = 0;
|
|
5820
5837
|
priv.websocket = setup_websocket(gobj);
|
|
5821
5838
|
return 0;
|
|
@@ -5826,7 +5843,6 @@ function mt_start(gobj) {
|
|
|
5826
5843
|
function mt_stop(gobj) {
|
|
5827
5844
|
let priv = gobj.priv;
|
|
5828
5845
|
clear_timeout(priv.gobj_timer);
|
|
5829
|
-
gobj_stop(priv.gobj_timer);
|
|
5830
5846
|
if (priv.websocket) close_websocket(gobj);
|
|
5831
5847
|
return 0;
|
|
5832
5848
|
}
|