Mon 2018.10.08
Thank you @MaBe for the working example:
http://forum.espruino.com/conversations/317394/#comment14111852
Q1: While this.start() does work when testing a module as a monolithic file:
this.start()
constructor(option) { var timeStart = 0; var timeStop = 0; if( typeof option == "string" ) { if( option == "auto" ) this.start();
an error occurs when testing as a deployed module:
>Uncaught Error: Function "start" not found! at line 5 col 18 this.start();
What is the correct syntax to reference an internal class method from inside that class?
Indicates Class Definition 1v96 Official using 1v99
http://www.espruino.com/Features
Q2: An error occurs when using a multi-parameter constructor when a default constructor is present
constructor() { // If option == "auto" auto start constructor(option) {
ERROR: [notify_error] Input_0:14: ERROR - Class contains duplicate method name "constructor" in moduleTestConstructor
Is the preferred method to use just the multi-parameter version and have implied optional arguments and code the single constructor for those options?
e.g. if( typeof option == "undefined" ) { if( option != "undefined" ) {
if( typeof option == "undefined" ) { if( option != "undefined" ) {
3 Attachments
@Robin started
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.
Mon 2018.10.08
Thank you @MaBe for the working example:
http://forum.espruino.com/conversations/317394/#comment14111852
Q1: While
this.start()
does work when testing a module as a monolithic file:an error occurs when testing as a deployed module:
What is the correct syntax to reference an internal class method from inside that class?
Indicates Class Definition 1v96 Official using 1v99
Q2: An error occurs when using a multi-parameter constructor when a default constructor is present
Is the preferred method to use just the multi-parameter version and have implied optional arguments and code the single constructor for those options?
e.g.
if( typeof option == "undefined" ) {
if( option != "undefined" ) {
3 Attachments