this confused me too at first, but I found cues to answer this question in this article by Cemre Güngör.
for layerGroupName of PSD
window[layerGroupName] = PSD[layerGroupName]
This one copies all the layers from the original object with imported layers to the window
object. This way all the layers become available using layerName
instead of PSD['layerName']
.
for layerGroupName of PSD
PSD[layerGroupName].originalFrame = window[layerGroupName].frame
frame
and originalFrame
here are actually keys in an object, not methods. These two lines copy the initial frame (including position of the layer etc.) of each layer under the originalFrame
key, so that when you change the position of layers, you can easily revert them to their original position.