|
|
Source code |
1 2 |
set(test,'1-2-3'); txtsplit(get(test),'-',my_array); |

This post has been edited 1 times, last edit by "Nupsi" (Jul 25th 2023, 6:46pm)
Now we have a krpano-array with [1,2,3]
var new_array = krpano.get("my_array");
This post has been edited 9 times, last edit by "indexofrefraction" (Jun 29th 2023, 10:32pm)

|
|
Source code |
1 2 3 4 5 6 7 |
const applyFilter = (data, filter) => data.filter(obj =>
Object.entries(filter).every(([prop, find]) => find.includes(obj[prop]))
);
var filter = {[id]:my_array};
result = (applyFilter(data, filter));
|
This post has been edited 2 times, last edit by "indexofrefraction" (Jul 2nd 2023, 1:37am)

|
|
Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
<action name="mytest" type="javascript" autorun="onstart">
// this function runs with global scope !
krpano.set("myvar", "1-2-3");
console.log("myvar",krpano.get("myvar"));
console.log("myvar",krpano.myvar); // same as above
krpano.actions.txtsplit(krpano.get("myvar"), "-", "myarr");
console.log("myarr",krpano.get("myarr"));
console.log("myarr",krpano.myarr); // same as above
console.log("myarr[0]",krpano.myarr.getItem(0));
console.log("myarr[0]",krpano.myarr.getItem(0).index);
console.log("myarr[0]",krpano.myarr.getItem(0).value);
console.log(krpano.myarr.getArray());
// console.log(krpano);
</action>
|
This post has been edited 4 times, last edit by "indexofrefraction" (Jul 3rd 2023, 8:01pm)