dev: add get_proxy_object to util/context

This commit is contained in:
KernelDeimos 2024-10-28 15:10:27 -04:00
parent 3649dff9aa
commit c0b109d4d2

View File

@ -75,6 +75,22 @@ class Context {
get values () { get values () {
return this.values_; return this.values_;
} }
/**
* @untested
*/
get_proxy_object () {
return new Proxy(this.values_, {
get: (target, prop) => {
return this.get(prop);
},
set: (target, prop, value) => {
this.set(prop, value);
return true;
},
});
}
constructor (imm_values, opt_parent, opt_name) { constructor (imm_values, opt_parent, opt_name) {
const values = { ...imm_values }; const values = { ...imm_values };
imm_values = null; imm_values = null;