@yuneta/gobj-js 7.9.9 → 7.9.10
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 +25 -6
- package/dist/gobj-js.cjs.js.map +1 -1
- package/dist/gobj-js.cjs.min.js +3 -3
- package/dist/gobj-js.cjs.min.js.map +1 -1
- package/dist/gobj-js.es.js +25 -6
- package/dist/gobj-js.es.js.map +1 -1
- package/dist/gobj-js.es.min.js +3 -3
- package/dist/gobj-js.es.min.js.map +1 -1
- package/dist/gobj-js.iife.js +25 -6
- package/dist/gobj-js.iife.js.map +1 -1
- package/dist/gobj-js.iife.min.js +3 -3
- package/dist/gobj-js.iife.min.js.map +1 -1
- package/dist/gobj-js.umd.js +25 -6
- package/dist/gobj-js.umd.js.map +1 -1
- package/dist/gobj-js.umd.min.js +3 -3
- 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
|
/***************************
|