Following advice to use TextDecoder for gjs since 1.70, using TextDecode/TextEncoder works fine on my development machine. However when I try running the app on a Raspberry Pi 4, it throws ReferenceError: TextEncoder not defined, after which I find the gjs version is 1.66.2-1.
I can go back to using byteArray as an alternative if gjs version is too low but how can I know which version is being used?
Nodejs has process.version - is there something like that for gjs?
Feature detection is in my opinion preferable, as it’s immediately clear in code which feature you need, and you don’t have to mess with versions. And that’s historically what’s been done in JavaScript, after we deciding that browser sniffing was a bad idea