@xuda.io/runtime-bundle 1.0.387 → 1.0.389
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-slim.js
CHANGED
|
@@ -11951,10 +11951,87 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
|
|
|
11951
11951
|
// },
|
|
11952
11952
|
// });
|
|
11953
11953
|
|
|
11954
|
-
Object.observe(_session.DS_GLB[paramsP.dsSessionP], function (changes) {
|
|
11955
|
-
|
|
11954
|
+
// Object.observe(_session.DS_GLB[paramsP.dsSessionP], function (changes) {
|
|
11955
|
+
// console.log(changes);
|
|
11956
|
+
// });
|
|
11957
|
+
|
|
11958
|
+
// create a new instance of `MutationObserver` named `observer`,
|
|
11959
|
+
// passing it a callback function
|
|
11960
|
+
// const observer = new MutationObserver(() => {
|
|
11961
|
+
// console.log('callback that runs when observer is triggered');
|
|
11962
|
+
// });
|
|
11963
|
+
|
|
11964
|
+
// // call `observe()`, passing it the element to observe, and the options object
|
|
11965
|
+
// observer.observe(_session.DS_GLB[paramsP.dsSessionP], {
|
|
11966
|
+
// subtree: true,
|
|
11967
|
+
// childList: true,
|
|
11968
|
+
// });
|
|
11969
|
+
//==================
|
|
11970
|
+
class ObjectObserver {
|
|
11971
|
+
constructor(targetObject, callback) {
|
|
11972
|
+
this.callback = callback;
|
|
11973
|
+
this.target = targetObject;
|
|
11974
|
+
|
|
11975
|
+
// Create a proxy to intercept property access and modifications
|
|
11976
|
+
this.proxy = new Proxy(targetObject, {
|
|
11977
|
+
set: (target, property, value) => {
|
|
11978
|
+
const oldValue = target[property];
|
|
11979
|
+
target[property] = value;
|
|
11980
|
+
|
|
11981
|
+
// Call the callback with mutation information
|
|
11982
|
+
this.callback({
|
|
11983
|
+
type: 'update',
|
|
11984
|
+
object: target,
|
|
11985
|
+
property,
|
|
11986
|
+
oldValue,
|
|
11987
|
+
newValue: value,
|
|
11988
|
+
});
|
|
11989
|
+
|
|
11990
|
+
return true;
|
|
11991
|
+
},
|
|
11992
|
+
|
|
11993
|
+
deleteProperty: (target, property) => {
|
|
11994
|
+
const oldValue = target[property];
|
|
11995
|
+
const deleted = delete target[property];
|
|
11996
|
+
|
|
11997
|
+
if (deleted) {
|
|
11998
|
+
this.callback({
|
|
11999
|
+
type: 'delete',
|
|
12000
|
+
object: target,
|
|
12001
|
+
property,
|
|
12002
|
+
oldValue,
|
|
12003
|
+
});
|
|
12004
|
+
}
|
|
12005
|
+
|
|
12006
|
+
return deleted;
|
|
12007
|
+
},
|
|
12008
|
+
});
|
|
12009
|
+
|
|
12010
|
+
return this.proxy;
|
|
12011
|
+
}
|
|
12012
|
+
|
|
12013
|
+
// Method to stop observing (for cleanup)
|
|
12014
|
+
disconnect() {
|
|
12015
|
+
this.callback = null;
|
|
12016
|
+
this.target = null;
|
|
12017
|
+
this.proxy = null;
|
|
12018
|
+
}
|
|
12019
|
+
}
|
|
12020
|
+
|
|
12021
|
+
// Usage example:
|
|
12022
|
+
const originalObject = _session.DS_GLB[paramsP.dsSessionP];
|
|
12023
|
+
|
|
12024
|
+
// Create observer with callback
|
|
12025
|
+
const observedObject = new ObjectObserver(originalObject, (mutation) => {
|
|
12026
|
+
console.log('Change detected:', mutation);
|
|
11956
12027
|
});
|
|
11957
12028
|
|
|
12029
|
+
// // These operations will trigger the callback
|
|
12030
|
+
// observedObject.name = "Jane"; // Property update
|
|
12031
|
+
// observedObject.job = "Developer"; // Property addition
|
|
12032
|
+
// delete observedObject.age; // Property deletion
|
|
12033
|
+
//==================
|
|
12034
|
+
|
|
11958
12035
|
return {};
|
|
11959
12036
|
},
|
|
11960
12037
|
'xu-bind': async function ($elm, val) {
|
|
@@ -10024,10 +10024,87 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
|
|
|
10024
10024
|
// },
|
|
10025
10025
|
// });
|
|
10026
10026
|
|
|
10027
|
-
Object.observe(_session.DS_GLB[paramsP.dsSessionP], function (changes) {
|
|
10028
|
-
|
|
10027
|
+
// Object.observe(_session.DS_GLB[paramsP.dsSessionP], function (changes) {
|
|
10028
|
+
// console.log(changes);
|
|
10029
|
+
// });
|
|
10030
|
+
|
|
10031
|
+
// create a new instance of `MutationObserver` named `observer`,
|
|
10032
|
+
// passing it a callback function
|
|
10033
|
+
// const observer = new MutationObserver(() => {
|
|
10034
|
+
// console.log('callback that runs when observer is triggered');
|
|
10035
|
+
// });
|
|
10036
|
+
|
|
10037
|
+
// // call `observe()`, passing it the element to observe, and the options object
|
|
10038
|
+
// observer.observe(_session.DS_GLB[paramsP.dsSessionP], {
|
|
10039
|
+
// subtree: true,
|
|
10040
|
+
// childList: true,
|
|
10041
|
+
// });
|
|
10042
|
+
//==================
|
|
10043
|
+
class ObjectObserver {
|
|
10044
|
+
constructor(targetObject, callback) {
|
|
10045
|
+
this.callback = callback;
|
|
10046
|
+
this.target = targetObject;
|
|
10047
|
+
|
|
10048
|
+
// Create a proxy to intercept property access and modifications
|
|
10049
|
+
this.proxy = new Proxy(targetObject, {
|
|
10050
|
+
set: (target, property, value) => {
|
|
10051
|
+
const oldValue = target[property];
|
|
10052
|
+
target[property] = value;
|
|
10053
|
+
|
|
10054
|
+
// Call the callback with mutation information
|
|
10055
|
+
this.callback({
|
|
10056
|
+
type: 'update',
|
|
10057
|
+
object: target,
|
|
10058
|
+
property,
|
|
10059
|
+
oldValue,
|
|
10060
|
+
newValue: value,
|
|
10061
|
+
});
|
|
10062
|
+
|
|
10063
|
+
return true;
|
|
10064
|
+
},
|
|
10065
|
+
|
|
10066
|
+
deleteProperty: (target, property) => {
|
|
10067
|
+
const oldValue = target[property];
|
|
10068
|
+
const deleted = delete target[property];
|
|
10069
|
+
|
|
10070
|
+
if (deleted) {
|
|
10071
|
+
this.callback({
|
|
10072
|
+
type: 'delete',
|
|
10073
|
+
object: target,
|
|
10074
|
+
property,
|
|
10075
|
+
oldValue,
|
|
10076
|
+
});
|
|
10077
|
+
}
|
|
10078
|
+
|
|
10079
|
+
return deleted;
|
|
10080
|
+
},
|
|
10081
|
+
});
|
|
10082
|
+
|
|
10083
|
+
return this.proxy;
|
|
10084
|
+
}
|
|
10085
|
+
|
|
10086
|
+
// Method to stop observing (for cleanup)
|
|
10087
|
+
disconnect() {
|
|
10088
|
+
this.callback = null;
|
|
10089
|
+
this.target = null;
|
|
10090
|
+
this.proxy = null;
|
|
10091
|
+
}
|
|
10092
|
+
}
|
|
10093
|
+
|
|
10094
|
+
// Usage example:
|
|
10095
|
+
const originalObject = _session.DS_GLB[paramsP.dsSessionP];
|
|
10096
|
+
|
|
10097
|
+
// Create observer with callback
|
|
10098
|
+
const observedObject = new ObjectObserver(originalObject, (mutation) => {
|
|
10099
|
+
console.log('Change detected:', mutation);
|
|
10029
10100
|
});
|
|
10030
10101
|
|
|
10102
|
+
// // These operations will trigger the callback
|
|
10103
|
+
// observedObject.name = "Jane"; // Property update
|
|
10104
|
+
// observedObject.job = "Developer"; // Property addition
|
|
10105
|
+
// delete observedObject.age; // Property deletion
|
|
10106
|
+
//==================
|
|
10107
|
+
|
|
10031
10108
|
return {};
|
|
10032
10109
|
},
|
|
10033
10110
|
'xu-bind': async function ($elm, val) {
|