Get a list of all layerComp in UXP

Hi,
I am across this: Other topic

BatchPlay enables me to select a layer comp but what if I want to cycle over all the layer comps? How do I get a list of all the layer comps?

To select I use this:

const batchPlay = require("photoshop").action.batchPlay;
const result = await batchPlay(
[
   {
      _obj: "applyComp",
      _target: [
         {
            _ref: "compsClass",
            _name: "batman"
         }
      ],
      _options: {
         dialogOptions: "dontDisplay"
      }
   }
],{
   synchronousExecution: false,
   modalBehavior: "execute"
});

I found a workaround but it may only work locally for you.

See here