@xuda.io/runtime-bundle 1.0.1326 → 1.0.1328

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.
@@ -24502,6 +24502,20 @@ func.api.call_javascript = async function (prog_id, params, evaluate) {
24502
24502
  return await api_utils.call_javascript(prog_id, params, evaluate);
24503
24503
  };
24504
24504
 
24505
+ func.api.watch = async function (path, cb) {
24506
+ if (!path) return 'path is mandatory';
24507
+ if (!cb) return 'cb (callback function) is mandatory';
24508
+ const SESSION_ID = Object.keys(SESSION_OBJ)[0];
24509
+ let _session = SESSION_OBJ[SESSION_ID];
24510
+ if (!_session.watchers) {
24511
+ _session.watchers = {};
24512
+ }
24513
+
24514
+ _session.watchers[path] = cb;
24515
+
24516
+ return 'ok';
24517
+ };
24518
+
24505
24519
  // func.api.call_javascript = async function (prog_id, params, evaluate) {
24506
24520
  // const SESSION_ID = Object.keys(SESSION_OBJ)[0];
24507
24521
  // const api_utils = await func.common.get_module(SESSION_ID, 'xuda-api-library.mjs', {
@@ -40703,6 +40717,8 @@ func.UI.main.embed_loader = async function (SESSION_ID) {
40703
40717
  // data: { ds_data: _session.DS_GLB[0], session_id: SESSION_ID },
40704
40718
  // });
40705
40719
  // }
40720
+
40721
+ func.index.set_ds_0_proxy(SESSION_ID);
40706
40722
  return ret;
40707
40723
  // });
40708
40724
  };
@@ -42589,6 +42605,13 @@ func.index.set_ds_0_proxy = function (SESSION_ID) {
42589
42605
  try {
42590
42606
  if (_.isEqual(newValue, oldValue)) return;
42591
42607
 
42608
+ const _session = SESSION_OBJ[SESSION_ID];
42609
+
42610
+ if (_session?.watchers?.[path]) {
42611
+ const fx = _session?.watchers?.[path];
42612
+ fx(change);
42613
+ }
42614
+
42592
42615
  if (!change.path.includes('data_system.SYS_GLOBAL_OBJ_REFS')) return;
42593
42616
  const ref_id = change.path.split('SYS_GLOBAL_OBJ_REFS.')[1].split('.')[0];
42594
42617
  if (!ref_id) return;