@xuda.io/xuda-worker-bundle 1.3.2462 → 1.3.2463

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.
Files changed (2) hide show
  1. package/index.js +14 -0
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -876,6 +876,20 @@ func.api.call_javascript = async function (prog_id, params, evaluate) {
876
876
  return await api_utils.call_javascript(prog_id, params, evaluate);
877
877
  };
878
878
 
879
+ func.api.watch = async function (path, cb) {
880
+ if (!path) return 'path is mandatory';
881
+ if (!cb) return 'cb (callback function) is mandatory';
882
+ const SESSION_ID = Object.keys(SESSION_OBJ)[0];
883
+ let _session = SESSION_OBJ[SESSION_ID];
884
+ if (!_session.watchers) {
885
+ _session.watchers = {};
886
+ }
887
+
888
+ _session.watchers[path] = cb;
889
+
890
+ return 'ok';
891
+ };
892
+
879
893
  // func.api.call_javascript = async function (prog_id, params, evaluate) {
880
894
  // const SESSION_ID = Object.keys(SESSION_OBJ)[0];
881
895
  // const api_utils = await func.common.get_module(SESSION_ID, 'xuda-api-library.mjs', {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/xuda-worker-bundle",
3
- "version": "1.3.2462",
3
+ "version": "1.3.2463",
4
4
  "description": "xuda framework",
5
5
  "main": "index.js",
6
6
  "scripts": {