src/pages/ps_reference/classes/layers.md
A collections class allowing for array access into the applications
list of layers on a document,
while also providing familiar methods from ExtendScript, like getByName
// Iterate through all the top layers of frontmost document
app.activeDocument.layers.forEach(h => console.log(h.name));
▪ [index: number]: Layer
Used to access the layers in the collection.
// Iterate through all the top layers of frontmost document
app.activeDocument.layers.forEach(h => console.log(h.name));
| Name | Type | Access | Min Version | Description |
|---|---|---|---|---|
| length | number | R | 22.5 | Number of Layer elements in this collection. |
| typename | string | R | 22.5 | The name for this object collection: Layers. |
<span class="minversion" style="display: block; margin-bottom: -1em; margin-left: 36em; float:left; opacity:0.5;">22.5</span>
async : Promise<Layer>
Create a new layer.
let newDoc1 = await app.activeDocument.layers.add();
<span class="minversion" style="display: block; margin-bottom: -1em; margin-left: 36em; float:left; opacity:0.5;">22.5</span>
Find the first layer with the matching name.
| Name | Type |
|---|---|
name | string |