static Update(Arr) {
static Update(Arr) {
let prop = Properties.GetContext().Get(SAVE_PROP_NAME)
let arr = [...Arr].map(i => {
let keys = Object.keys(i)
let obj = []
for (let j = 0; j < keys.length; j++) {
let iter = i[keys[j]]
if (typeof iter == 'function') {
obj[iter] = [iter.name, iter.toString()]
break
}
}
return i = Object.assign(obj, i)
})
prop.Value = JSON.stringify(arr)
}
static Update(arr) {
try {
const prop = Properties.GetContext().Get(SAVE_PROP_NAME);
const updatedArr = arr.map(item => {
const functionMap = {};
Object.entries(item).forEach(([key, value]) => {
if (typeof value === 'function') {
functionMap[key] = {name: value.name, code: value.toString()};
}
});
return {...item, ...functionMap};
});
prop.Value = JSON.stringify(updatedArr);
return true;
} catch (error) {
return false;
}
}