Hi Simon,
your solution makes total sense, but just out of curiosity: why do you prefer/use batchPlay and not DOM code for this? Is it because of speed, personal preference or anything else? Thanks!
Speed is usually a factor (batchplay is faster), however for a getter the difference wouldn’t really be noticable. I just build all my plugins with batchPlay only, because I know 100% of what’s scriptable is available through batchPlay, and only a subset of it via DOM - and I don’t really like mixing technologies.
That’s why I don’t really bother checking what’s available in the DOM, when I know I already have a solution at hand
In addition to that, a lot of the verbosity of batchPlay can be abtracted over time by moving things to reusable functions. So effectively, I would probably only have to write something like
if(getLayerProperty("depth") === 16) {
// logic for 16 bit
} else {
// logic for 8 bit or other
}
which would be equally few lines of code as a DOM implementation.