@xuda.io/runtime-bundle 1.0.1357 → 1.0.1359
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/js/xuda-runtime-bundle.js +5 -2
- package/js/xuda-runtime-bundle.min.js +1 -1
- package/js/xuda-runtime-slim.js +5 -2
- package/js/xuda-runtime-slim.min.es.js +5 -2
- package/js/xuda-runtime-slim.min.js +1 -1
- package/js/xuda-server-bundle.min.mjs +1 -1
- package/js/xuda-server-bundle.mjs +5 -2
- package/js/xuda-worker-bundle.js +5 -2
- package/js/xuda-worker-bundle.min.js +1 -1
- package/js/xuda_common-bundle.js +5 -2
- package/js/xuda_common-bundle.min.js +1 -1
- package/package.json +1 -1
package/js/xuda-runtime-slim.js
CHANGED
|
@@ -2500,7 +2500,7 @@ func.api.call_javascript = async function (prog_id, params, evaluate) {
|
|
|
2500
2500
|
return await api_utils.call_javascript(prog_id, params, evaluate);
|
|
2501
2501
|
};
|
|
2502
2502
|
|
|
2503
|
-
func.api.watch = function (path, cb) {
|
|
2503
|
+
func.api.watch = function (path, cb, opt = {}) {
|
|
2504
2504
|
if (!path) return 'path is mandatory';
|
|
2505
2505
|
if (!cb) return 'cb (callback function) is mandatory';
|
|
2506
2506
|
const SESSION_ID = Object.keys(SESSION_OBJ)[0];
|
|
@@ -2510,7 +2510,10 @@ func.api.watch = function (path, cb) {
|
|
|
2510
2510
|
}
|
|
2511
2511
|
|
|
2512
2512
|
_session.watchers[path] = cb;
|
|
2513
|
-
|
|
2513
|
+
if (opt.immediate) {
|
|
2514
|
+
const value = _.get(SESSION_OBJ[SESSION_ID].DS_GLB[0], path);
|
|
2515
|
+
cb({ path, newValue: value, oldValue: value, timestamp: Date.now(), opt });
|
|
2516
|
+
}
|
|
2514
2517
|
return 'ok';
|
|
2515
2518
|
};
|
|
2516
2519
|
|
|
@@ -2501,7 +2501,7 @@ func.api.call_javascript = async function (prog_id, params, evaluate) {
|
|
|
2501
2501
|
return await api_utils.call_javascript(prog_id, params, evaluate);
|
|
2502
2502
|
};
|
|
2503
2503
|
|
|
2504
|
-
func.api.watch = function (path, cb) {
|
|
2504
|
+
func.api.watch = function (path, cb, opt = {}) {
|
|
2505
2505
|
if (!path) return 'path is mandatory';
|
|
2506
2506
|
if (!cb) return 'cb (callback function) is mandatory';
|
|
2507
2507
|
const SESSION_ID = Object.keys(SESSION_OBJ)[0];
|
|
@@ -2511,7 +2511,10 @@ func.api.watch = function (path, cb) {
|
|
|
2511
2511
|
}
|
|
2512
2512
|
|
|
2513
2513
|
_session.watchers[path] = cb;
|
|
2514
|
-
|
|
2514
|
+
if (opt.immediate) {
|
|
2515
|
+
const value = _.get(SESSION_OBJ[SESSION_ID].DS_GLB[0], path);
|
|
2516
|
+
cb({ path, newValue: value, oldValue: value, timestamp: Date.now(), opt });
|
|
2517
|
+
}
|
|
2515
2518
|
return 'ok';
|
|
2516
2519
|
};
|
|
2517
2520
|
|