Xgenia.Arrays
Only available on the frontend
The third part of the global data model in Xgenia are arrays. Each array is reference by its Id using the Xgenia.Arrays
prefix, similar to objects and variables. You can learn more about arrays in the arrays guide. Changing an array will trigger an update of all Array node with the corresponding Id.
note
Generally arrays in Xgenia are expected to contain objects. There is nothing stopping you putting other stuff in arrays but
// This will change the array with id MyArray and update all Arrays nodes
// with that id.
Xgenia.Arrays.MyArray = [{ Hello: "There" }];
// Use this if you have spaces in your array id
Xgenia.Arrays["Recepie List"] = [{ Name: "Fancy Burger" }];
// Reading arrays
console.log(Xgenia.Arrays.MyArray);
// WARNING, you can access arrays like this but this will not trigger an update
// in Xgenia. You should avoid modifying arrays like this.
Xgenia.Arrays.MyArray.push({ Hello: "Again" });
// Instead, create a new array. This will trigger an update
// on all Array nodes with id MyArray
Xgenia.Arrays.MyArray = Xgenia.Arrays.MyArray.concat([{ Hello: "Again" }]);