@xuda.io/runtime-bundle 1.0.1327 → 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', {
@@ -42591,6 +42605,13 @@ func.index.set_ds_0_proxy = function (SESSION_ID) {
42591
42605
  try {
42592
42606
  if (_.isEqual(newValue, oldValue)) return;
42593
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
+
42594
42615
  if (!change.path.includes('data_system.SYS_GLOBAL_OBJ_REFS')) return;
42595
42616
  const ref_id = change.path.split('SYS_GLOBAL_OBJ_REFS.')[1].split('.')[0];
42596
42617
  if (!ref_id) return;