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