Thanks - yes, it looks like there's some issue with Espruino there. It's a strange one as I added it in 2v22 and was pretty sure it was working at that point (but then I wasn't working on getters). I just filed an issue in https://github.com/espruino/Espruino/issues/2517
I feel like having a getter to handle this is probably overkill though?
You could have a static propery like GP8403.CH1="CH1"; and so on, and then:
const channels = { CH0: data_for_ch, CH1: data_for_ch ];
if (!channels[channel]) throw new Exception("Invalid channel");
I think that's what you were saying? The JS classes are effectively just shorthand for writing out object oriented JS as functions, so if you do want static fields and want to target existing firmwares before I have fixed the issue, you can fix and match - so:
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Thanks - yes, it looks like there's some issue with Espruino there. It's a strange one as I added it in 2v22 and was pretty sure it was working at that point (but then I wasn't working on getters). I just filed an issue in https://github.com/espruino/Espruino/issues/2517
I feel like having a getter to handle this is probably overkill though?
You could have a static propery like
GP8403.CH1="CH1";
and so on, and then:I think that's what you were saying? The JS classes are effectively just shorthand for writing out object oriented JS as functions, so if you do want static fields and want to target existing firmwares before I have fixed the issue, you can fix and match - so:
should all work ok?