class Field {
constructor(index, buttonsPerLine) {
console.log("Constructor called");
}
}
var f0=new Field(0,3);
When I upload it into the Bangle 2 emulator using the Web IDE, I get "Constructor called" on the console, as expected.
When I upload it with enabled Esprima minification, I get
Uncaught ReferenceError: "Field" is not defined
at line 1 col 61
...Constructor called')}}var f0=new Field(0,3)
When I shrink the source code to simply
class Field {
constructor(index, buttonsPerLine) {
}
}
var f0=new Field(0,3);
I see the following error message on uploading the minified code:
Uncaught ReferenceError: "Field" is not defined
at line 1 col 28
class a{constructor(a,b){}}var f0=new Field(0,3)
To me it seems that the Esprima minificator changes the name of the defined class from "Field" to "a" and then cannot find the class "Field" - which is not too surprising…
Is this expected behaviour? Am I doing something wrong? I'm quite new to Javascript programming but to me the code looks totally reasonable.
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.
I have this source code
When I upload it into the Bangle 2 emulator using the Web IDE, I get "Constructor called" on the console, as expected.
When I upload it with enabled Esprima minification, I get
When I shrink the source code to simply
I see the following error message on uploading the minified code:
To me it seems that the Esprima minificator changes the name of the defined class from "Field" to "a" and then cannot find the class "Field" - which is not too surprising…
Is this expected behaviour? Am I doing something wrong? I'm quite new to Javascript programming but to me the code looks totally reasonable.
Any help appreciated!
Best regards,
Dirk