I'm a bit stuck with something (hoping simple), maybe someone here can have a look and point that simple thing I'm missing.
I am getting some objects and wanna push them to an array.
on push, getting the error: Cannot add property 0, object is not extensible
if (keysLength > 0) {
//@ts-ignore
let Arr = [];
for(let x = 0; x < keysLength; x++) {
let keys = "item" + x;
// getting all the items from storage
// and merging into 1 array
chrome.storage.sync.get([keys], function(result) {
// err: Cannot add property 0, object is not extensible
Arr.push(result[keys]);
});
if (x === keysLength-1){
console.log(Arr)
}
}
}
appreciate the time